Cv2 reads the picture and reports an error

The error content is as follows:

wrong reason:

 1. Path problem: the read image path cannot contain Chinese names;

2. "\" in python represents an escape character, and double slashes are required when not used as an escape character, that is, "\\"

Note: For the first line of code, as cv will be omitted in some programs. In this case, you need to change the cv in the fifth and sixth lines of code to cv2, otherwise the prompt "name 'cv' is not defined" will appear ,as the picture shows

Refer to the following blog: Solve cv2.error: OpenCV(4.1.1) C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor' - Wood Wood Paper - Blog Garden (cnblogs.com)

Guess you like

Origin blog.csdn.net/songlinjine/article/details/125697043