Я использую Ubuntu 16.04 на vm player.Я написал скрипт для подключения веб-камеры ноутбука.Но я получил select timeout
ошибку с r et, frame = video_capture.read()
, хотя я выбрал камеру из раздела «съемные устройства» .
Когда я попытался запустить скрипт на Windows, он был успешным.
код: read_video.py
import numpy as np
import cv2
video_capture = cv2.VideoCapture(0)
while(True):
ret, frame = video_capture.read()
cv2.imshow("Frame",frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
video_capture.release()
cv2.destroyAllWindows()
ошибка:
read_video.py
select timeout
select timeout
OpenCV Error: Assertion failed (total() == 0 || data != __null) in Mat, file /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/core/include/opencv2/core/mat.inl.hpp, line 500
Traceback (most recent call last):
File "read_video.py", line 9, in <module>
ret, frame = video_capture.read()
cv2.error: /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/core/include/opencv2/core/mat.inl.hpp:500: error: (-215) total() == 0 || data != __null in function Mat
Как мне ее решить?