【opencv相关报错】

转载请注明出处:https://mp.csdn.net/postedit/80642765

1.【报错内容】OpenCV(3.4.1) Error: Assertion failed (size.width>0 && size.height>0) in imshow, file /home/can/Opencv/opencv-3.4.1/modules/highgui/src/window.cpp, line 356 terminate called after throwing an instance of 'cv::Exception'   what():  OpenCV(3.4.1) /home/can/

【解决方法】

 

(1)图片的名称要一致,比如本程序的img.jpg,就必须对应的是名称为imgjpg格式的图片。

(2)就是如果不是指具体路径,就默认要把图片放到工作目录,即,程序源码所在的的目录

2.【报错内容】Error: Assertion failed (size.width>0 && size.height>0) in imshow, file /home/can/opencv-3.4.1/modules/highgui/src/window.cpp, line 356
terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(3.4.1) /home/can/opencv-3.4.1/modules/highgui/src/window.cpp:356: error: (-215) size.width>0 && size.height>0 in function imshow

【解决方法】

参考文章:https://blog.csdn.net/langb2014/article/details/50555016

https://blog.csdn.net/ZJ651927693/article/details/11490633