openCVでカメラから映像を取得したいのですが、このようなエラーが出ます。
色々調べたのですが、解決できませんでした。
ご教授ください。
python
import cv2 capture = cv2.VideoCapture(0) while(True): ret, frame = capture.read() cv2.imshow('frame',frame) if cv2.waitKey(1) & 0xFF == ord('q'): break capture.release() cv2.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'
まだ回答がついていません
会員登録して回答してみよう