cv2.VideoCapture(0).isOpened() return always false

asked 2019-06-25 14:38:20 -0500

Aglo gravatar image

updated 2019-06-25 15:59:28 -0500

Some information on my configuration :

windows 10

python 3.7.3

openCV 4.1.0 (get with the command : cv2.__version__)

My problem is that the following code return me False all time, so i think that the program can't find my integrated camera( i have a laptop). But i don't know, so the problem may come from everywhere...

import cv2
cap = cv2.VideoCapture(0)
print( cap.isOpened() )

I think that i have a good installation of opencv and python because i can open a video with the following code :


So i don't know how to solve my problem, thanks for help and sorry for my english.

edit retag flag offensive close merge delete



can you try again in english, please ?

berak gravatar imageberak ( 2019-06-25 15:01:03 -0500 )edit

that's done, thanks to take time for me

Aglo gravatar imageAglo ( 2019-06-25 16:01:32 -0500 )edit

have you tried another cap position? Try VideoCapture(1) or VideoCapture(2). If you've never used the camera before you might have to manually turn the camera on with Fn+F6 and then turn it off then run your script. Check your camera privacy settings

eshirima gravatar imageeshirima ( 2019-06-27 07:41:21 -0500 )edit

cap = cv2.VideoCapture(2) then it work for me, thanks

tungsten gravatar imagetungsten ( 2020-01-31 21:28:27 -0500 )edit