Problem in loading the image.. [closed]

asked 2017-12-16 07:22:15 -0500

KRK gravatar image

updated 2017-12-16 07:25:18 -0500

berak gravatar image

import numpy as np import cv2

img = cv2.imread("mud.jpeg",cv2.IMREAD_COLOR)

cv2.imshow("bhatnagar",img) cv2.waitKey(5)

This is the error I am getting: I have even tried by giving the path of the image which could also be done if in case the file is not in the working directory.

OpenCV Error: Assertion failed (size.width>0 && size.height>0) in cv::imshow, file C:\projects\opencv-python\opencv\modules\highgui\src\window.cpp, line 325

cv2.imshow("bhatnagar",img) cv2.error: C:\projects\opencv-python\opencv\modules\highgui\src\window.cpp:325: error: (-215) size.width>0 && size.height>0 in function cv::imshow

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by berak
close date 2017-12-18 02:23:16.526499


it did not find the image, or it is not a jpg, but a mislabelled gif.

anyway, you have to check if image!=None: before proceeding with imshow() or the like.

berak gravatar imageberak ( 2017-12-16 07:28:14 -0500 )edit

Thanks a lot..done...

KRK gravatar imageKRK ( 2017-12-16 07:36:10 -0500 )edit