code:
import cv2
import numpy as np
from matplotlib import pyplot as plt
img = cv2.imread('test1.jpg',cv2.IMREAD_GRAYSCALE)
cv2.imshow('image',img)
cv2.waitKey(0)
cv2.destroyAllWindows()
error:
Traceback (most recent call last): File "C:\Users\user\Desktop\folder\python file", line 6, in cv2.imshow('image',img)
cv2.error: OpenCV(4.4.0) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-h4wtvo23\opencv\modules\highgui\src\window.cpp:376: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow'
test1.jpg
in the directory in which your program is running. – Mark Setchell