Hang encounter when debugging the code:
Grayscale reading cv2.imread found to get pictures of 3-channel, have been confirmed found, cv2.imread () function is a default read color images, grayscale want to read, you need to set parameters .
Use function cv2.imread (filepath, flags) read a photo
- filepath: To read the full path of the picture
- flags: read picture logo
- cv2.IMREAD_COLOR: the default parameters, reads a color picture, ignoring the alpha channel
- cv2.IMREAD_GRAYSCALE: read grayscale images
- cv2.IMREAD_UNCHANGED: As the name suggests, read the complete picture, including the alpha channel