Ask Your Question
0

OpenCV(3.4.2) C:\projects\opencv-python\opencv\modules\highgui\src\window.cpp:356: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow

asked 2020-05-10 15:16:05 -0600

Devilal Kumawat gravatar image

updated 2020-05-10 15:41:13 -0600

supra56 gravatar image

Error:

OpenCV(3.4.2) C:\projects\opencv-python\opencv\modules\highgui\src\window.cpp:356: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow

Please resolve this issue:

import numpy as np
import matplotlib.pyplot as plt
import cv2
im1 = cv2.imread('C://Test-C//33319//33319_2ms.jpg');
cv2.imshow('image', im1 );
cv2.waitKey(0)
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2020-05-10 15:22:22 -0600

HYPEREGO gravatar image

It can't open the image correctly. Check if the path is correct and the file exist. The error is very easy to be understood: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow basically the function that have to show to you the image (imshow) throw an error because the size of the image is not positive, it means that the reading operation have failed.

edit flag offensive delete link more

Comments

3

No known OS uses double forward slashes as path separator.

mvuori gravatar imagemvuori ( 2020-05-10 18:54:49 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-05-10 15:16:05 -0600

Seen: 27,758 times

Last updated: May 10 '20