openCVでカメラから映像を取得したいのですが、このようなエラーが出ます。
色々調べたのですが、解決できませんでした。
ご教授ください。
python
1import cv2 2capture = cv2.VideoCapture(0) 3 4while(True): 5 ret, frame = capture.read() 6 cv2.imshow('frame',frame) 7 if cv2.waitKey(1) & 0xFF == ord('q'): 8 break 9 10capture.release() 11cv2.destroyAllWindows()
バージョン情報 python 3.7.11 openCV 3.4.2 macOS Big Sur version 11.6.1
エラー文 Traceback (most recent call last): File "project3.py", line 8, in <module> cv2.imshow('frame',frame) cv2.error: OpenCV(3.4.2) /opt/concourse/worker/volumes/live/9523d527-1b9e-48e0-7ed0-a36adde286f0/volume/opencv-suite_1535558719691/work/modules/highgui/src/window.cpp:356: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'imshow'
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。