Assertion failure : size.width>0 && size.height>0 in function imshow

前端 未结 10 1270
失恋的感觉
失恋的感觉 2020-11-30 12:19

i am using opencv2 and python on raspberry pi. and i am new with python and opencv. i tried to read a jpeg image and display image it shows the following error:

<         


        
10条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-30 13:18

    The image fails to load (probably because you forgot the leading / in the path). imread then returns None. Passing None to imshow causes it to try to create a window of size 0x0, which fails.

    The poor error handling in cv probably owes to its quite thin wrapper layer on the C++ implementation (where returning NULL on error is a common practice).

提交回复
热议问题