OpenCV-Python learning (1) Picture of GUI features in OPENCV

1, read the image 

import numpy as np
import cv2
img = cv2.imread('messi5.jpg',0)

0: cv2.IMREAD_GRAYSCALE: read the image in grayscale mode

1: cv2.IMREAD_COLOR: Read in a color image. The transparency of the image will be ignored, this is the default parameter

  cv2.IMREAD_UNCHANGED: read in an image, and include the alpha channel of the image

2. Display image


cv2.imshow('image',img)
cv2.waitKey(0)
cv2.destroyAllWindows()

cv2.waitKey() is a keyboard binding function. The function waits a certain number of milliseconds to see if there is any keyboard input. Continue if there is input, 0 represents infinite wait

cv2.destroyAllWindows() can easily delete any windows we create

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324837737&siteId=291194637