Answer the question
In order to leave comments, you need to log in
Why doesn't the code with opencv-python work?
Good afternoon! I decided to learn OpenCV, but the very first example from the Internet did not want to work on my computer. How to solve the problem?
import cv2
def load_image():
img = cv2.imread('qrcode.jpg', cv2.IMREAD_GRAYSCALE)
cv2.imshow('me', img)
cv2.waitKey(0)
cv2.imwrite('grayMe.jpg', img)
load_image()
Traceback (most recent call last):
File "C:\Users\Багаудин\PycharmProjects\pythonProject5\main.py", line 11, in <module>
load_image()
File "C:\Users\Багаудин\PycharmProjects\pythonProject5\main.py", line 6, in load_image
cv2.imshow('me', img)
cv2.error: OpenCV(4.5.1) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-wvn_it83\opencv\modules\highgui\src\window.cpp:376: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow'
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question