I installed OpenCV through Homebrew on my system and installed the opencv-python
module through pip
.
My code:
import cv2
img = cv2.imread("image.png")
cv2.imshow("Image", img)
cv2.waitKey(0)
The error it gives:
cv2.imshow("Image", img)
cv2.error: OpenCV(4.5.0) /tmp/opencv-20201123-26930-m95s1u/opencv-4.5.0/modules/highgui/src/window.cpp:376: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'imshow'
If I read through the documentation or look through other resources, I'm doing the same steps. Can anyone help me out?