close

[Solved] Error (-215) size.width>0 && size.height>0 occurred when attempting to display an image using OpenCV

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Error (-215) size.width>0 && size.height>0 occurred when attempting to display an image using OpenCV in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Error (-215) size.width>0 && size.height>0 occurred when attempting to display an image using OpenCV Error Occurs?

Today I get the following error Error (-215) size.width>0 && size.height>0 occurred when attempting to display an image using OpenCV in python.

How To Solve Error (-215) size.width>0 && size.height>0 occurred when attempting to display an image using OpenCV Error ?

  1. How To Solve Error (-215) size.width>0 && size.height>0 occurred when attempting to display an image using OpenCV Error ?

    To Solve Error (-215) size.width>0 && size.height>0 occurred when attempting to display an image using OpenCV Error Make sure you have given the correct path of image. This error comes only when you have given wrong path.

  2. Error (-215) size.width>0 && size.height>0 occurred when attempting to display an image using OpenCV

    To Solve Error (-215) size.width>0 && size.height>0 occurred when attempting to display an image using OpenCV Error Make sure you have given the correct path of image. This error comes only when you have given wrong path.

Solution 1

This error shows when either,

  1. path of the image is wrong.
  2. name of the image is wrong.

We can check it by using ‘print(img)‘ command after ‘img = cv2.imread('C:\\Utilisateurs\\Zeineb\\Bureau\\image.jpg',0)‘ if output is ‘None’ then either path or name of the image is wrong. If output is matrix then image read is successful.
In code ‘cv2.waitKey(0)‘ zero shows the millisecond for which image will appear on the screen so it should be greater than zero something like 5000.

Solution 2

Make sure you have given the correct path of image. This error comes only when you have given wrong path.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read