2. OpenCV image reading and display

2. OpenCV image reading and display2.1. Image reading2.2. Image display2.3. Actual effect display

2.1. Image reading

img = cv2.imread('yahboom.jpg', 0) The first parameter is the path of the image, and the second parameter is how to read the image.

cv2.IMREAD_UNCHANGED: Keep the original format unchanged, -1;

cv2.IMREAD_GRAYSCALE: Read the image in grayscale mode, which can be represented by 0;

cv2.IMREAD_COLOR: Read a color image, which can be represented by 1; the default value

cv2.IMREAD_UNCHANGED: Read an image and include its alpha channel, which can be represented by 2.

2.2. Image display

cv.imshow('frame', frame): Open a window named frame and display frame data (image/video data)

Parameter meaning:

The first parameter indicates the name of the window to be created

The second parameter indicates the image to be displayed

2.3. Actual effect display

Code path:

/home/pi/DOGZILLA_Lite_class/4.Open Source CV/A.introduction/Introduction_to_OpenCV/02_OpenCV_Img_Read_Display.ipynb