Cv2 error problem

Traceback (most recent call last):
File “E:/masterclass/AI/ex1.py”, line 3, in
cv2.imshow(“pavan”,img)
cv2.error: OpenCV(4.5.1) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-oduouqig\opencv\modules\highgui\src\window.cpp:376: error: (-215:Assertion failed) size.width>0 && size.height>0 in function ‘cv::imshow’

Your img has zero width or zero height, or both. Now, how could that be?

raceback (most recent call last):
File “E:/certifi.m/ex.py”, line 3, in
greyimage=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
cv2.error: OpenCV(4.5.1) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-oduouqig\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function ‘cv::cvtColor’

Hi,

I see this error a lot for myself and it is usually down to the path to your img is not correct.
Can you confirm that is correct.

1 Like