Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

that's a simple one - your image did not load (and thus is empty / None).

lesson here, whenever you read any resource from disc, you have to check if that operation succeeded !

 img = cv2.imread('result.jpg')
 if img not None:
      ## do something with img

even if you use exactly the same code, as other people, your filestructure might differ, so, again: CHECK !

that's a simple one - your image did not load (and thus is empty / None).

lesson here, whenever you read any resource from disc, you have to check if that operation succeeded !

 img = cv2.imread('result.jpg')
 if img not None:
None: 
      ## do something with img
 else:
      ## most likely, the path to the image was wrong

even if you use exactly the same code, as other people, your filestructure might differ, so, again: CHECK !