How to load an image by OpenCV in Python

Опубликовано: 17 Март 2026
на канале: Md. Iqbal Hossain
224
4

In this video i m going to show how to load an image in different mode with different window name.

In this video on OpenCV Python Tutorial For Beginners, I am going to show How to Read, Write, Show Images in OpenCV. we will se how to use cv2.imread('lena.jpg', -1) to read and image, cv2.imshow('image', img) to show an image in a window,
cv2.waitKey(0) to wait for a key event, cv2.destroyAllWindows() to destroy all windows, cv2.imwrite('lena_copy.png', img) to write images to file.

OpenCV github page
https://github.com/opencv/opencv

Read an image
cv2.imread() Second argument is a flag which specifies the way image should be read.
flag integer value description
cv2.IMREAD_COLOR 1 Loads a color image.
cv2.IMREAD_GRAYSCALE 0 Loads image in grayscale mode
cv2.IMREAD_UNCHANGED -1 Loads image as such including alpha channel

pip is a package management system used to install and manage software packages written in Python.
OpenCV is an image processing library created by Intel and later supported by Willow Garage and now maintained by Itseez. opencv is available on Mac, Windows, Linux. Works in C, C++, and Python.
it is Open Source and free. opencv is easy to use and install.

Starting with an overview of what the course will be covering, we move on to discussing morphological operations and practically learn how they work on images. We will then learn contrast enhancement using equalization and contrast limiting. Finally we will learn 3 methods to subtract the background from the video and implement them using OpenCV.

At the end of this course, you will have a firm grasp of Computer Vision techniques using OpenCV libraries. This course will be your gateway to the world of data science.

Feel the real power of Python and programming! The course offers you a unique approach of learning how to code by solving real world problems.

#ProgrammingKnowledge #ComputerVision #OpenCV