Development in python OpenCV cv2 given AttributeError: 'NoneType' object has no attribute 'shape'

The reason for this problem is the image path or picture itself is the problem.
1. Check images using the image path as a.jpg images './image/a.jpg' picture on the two paths are in the directory code directory, 'image / a.jpg' picture is on the path code directory the next layer catalog
can reference the picture in the same directory under the code using 'a.jpg'.
2. When placing pictures in the project, pay attention to copy and paste the picture in the folder, try not to copy and paste the picture at the assembly tool. This is my problem arise: This problem occurs when I use pycharm development of cv2 python module. After the operation will solve the problem in the picture folder.

Guess you like

Origin www.cnblogs.com/supershuai/p/12330529.html