0
This error means that you are loading an empty image. As specified in the error, the image must have a width > 0 and a height > 0.
Here, I was able to open an image with exactly the same code.
Possible causes of error:
The image does not exist in the directory. Vale checks again and try something like:
cv2.imread("C:\\path\\to\\image.png")
orcv2.imread("C:/path/to/image.png"));
The image extension may be wrong. Remember, .jpg is other than .jpeg
- You may not have direct access to the image folder.
Complementing what Guilherme said about the image path, it is worth noting that when you use the relative path to refer to a file, python will start searching based on the directory defined in PYTHONPATH, an environment variable with the local directory assigned when calling the interpreter. So by your traceback, the image you upload should be on the Desktop. But by organization, create directories for your projects and put everything possible concerning them there. Calling the python command always from their root.
– Ronald Rodrigues