Opencv “select timeout” error with camera_capture on vm Ubuntu 16.04

asked 2018-12-07 02:39:41 -0600

selcuk yolcu gravatar image

updated 2018-12-07 02:50:49 -0600

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?

edit retag flag offensive close merge delete

Comments

Is your problem solved ? If solved please provide the solution. I am facing the exact same issue.

Sai Krishna gravatar imageSai Krishna ( 2019-06-24 14:53:47 -0600 )edit