Currently, I'm running some python code on my Ubuntu VM. The VM detects and connects to my Logitech C920, Here is the code I used to connect to the cam:
stream = cv2.VideoCapture(-1)
time.sleep(10.0)
if not (stream.isOpened()):
print("Failed to get Video Capture")
I gave it 10 secs just to make sure that the cam fully loads before extracting the frame from the live feed. I used cv2.imshow() to view the frame and it is all black even though the camera is connected and greenlit when the code ran.
I noticed that the app Cheese has the same problems while guvcview works fine. Does anyone have any ideas about what may happen? Its been a couple days since I stuck with this problem so any help would be fantastic!
P.S: I found a relevant question on Stack overflow as well: Webcam doesn't read through OpenCV but does with guvcview but there is no answer yet
Try setting indices other than -1 :