Opencv “select timeout” error with camera_capture on vm Ubuntu 16.04
I am using Ubuntu 16.04 on vm player. I have written a script to connect laptop's webcam. But, I got select timeout error with
ret, frame = video_capture.read()
, although I selected camera from "removable devices" section.
When I tried to run script on windows, it was successful.
code: 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()
error:
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
How can I solve it?
Is your problem solved ? If solved please provide the solution. I am facing the exact same issue.