Robotics StackExchange | Archived questions

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:

readvideo.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 "readvideo.py", line 9, in ret, frame = videocapture.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?

Asked by selcuk yolcu on 2018-12-07 03:39:41 UTC

Comments

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

Asked by Sai Krishna on 2019-06-24 14:53:47 UTC

Answers