Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

it is pretty simple.

to the dismay of most python noobs, cv2.imread() does NOT throw an exception on failure, it's your resposibility to check the outcome similar to:

if img == None: # older numpy / py2
     # fail !!

or:

if np.shape(img) == (): # latest numpy / py3
     # fail !!

if you don't, your NEXT line of code will fail (because you supplied invalid input), to ultimate confusion of anyone ...

it is pretty simple.

to the dismay of most python noobs, cv2.imread() does NOT throw an exception on failure,

it's your resposibility to check the outcome similar to:

if img == None: # older numpy / py2
     # fail !!

or:

if np.shape(img) == (): # latest numpy / py3
     # fail !!

if you don't, your NEXT line of code will fail (because you supplied invalid input), to ultimate confusion of anyone ...

it is pretty simple.

to the dismay of most python noobs, cv2.imread() does NOT throw an exception on failure,

it's your resposibility to check the outcome similar to:

if img == None: # older numpy / py2
     # fail !!

or:

if np.shape(img) == (): # latest numpy / py3
     # fail !!

if you don't, your NEXT line of code will fail (because you supplied invalid input), to ultimate confusion of anyone ...

ps: the code path in the error msg points to the location, where it was built (svark's box in the case of pypi), not your one.

it is pretty simple.

to the dismay of most python noobs, cv2.imread() does NOT throw an exception on failure,

it's your resposibility to check the outcome similar to:

if img == None: # older numpy / py2
     # fail !!

or:

if np.shape(img) == (): # latest numpy / py3
     # fail !!

if you don't, your NEXT line of code will fail (because you supplied invalid input), to ultimate confusion of anyone ...

ps: the code path in the error msg points to the location, location (in the underlyingc++ code), where it was built (svark's box in the case of pypi), not your one.

it is pretty simple.

to the dismay of most python noobs, cv2.imread() does NOT throw an exception on failure,

it's your resposibility to check the outcome similar to:

img = cv2.imread("butterfly,jpg",1 )
if img == None: # older numpy / py2
     # fail !!

or:

if np.shape(img) == (): # latest numpy / py3
     # fail !!

if you don't, your NEXT line of code will fail (because you supplied invalid input), to ultimate confusion of anyone ...

ps: the code path in the error msg points to the location (in the underlyingc++ code), where it was built (svark's box in the case of pypi), not your one.