0

I have installed openCV 3.1.0 with python3.5 every thing seemed to work fine during installation however when I am trying to execute even the following simple program, it doesn't work. OpenCV doesn't detect the camera.

isOpened() function always returning false

I checked, and the webcam has the id 0, I also tried other values (1,2,-1) but none of them seems to work, it always shows false. I have gone through similar questions on stack overflow, but none of the solutions seems to work. I have also tried re-installing openCV multiple times, it doesn't help either.

Please help.

udion
  • 89
  • 1
  • 3
  • is it usb plugged camera? – be_good_do_good Dec 10 '17 at 17:27
  • no it's the default one, I have also tried usb plugged (with port 0,1,2,-1 and I checked when usb cam is plugged, the default cam is at 0 and usb one is at 1). It doesn't work for either of them. – udion Dec 11 '17 at 06:26

1 Answers1

0

You should change default camera to video to test. e.g.

import cv2
cap = cv2.VideoCapture(r'E:/test.mp4')
if cap.isOpened():
    print('OK')
else:
    print('error')

If the result is 'OK',then modify "cap = cv2.VideoCapture(r'E:/test.mp4')" to "cap = cv2.VideoCapture(0)",if the result is 'error',I think there is something wrong with your camera.

  • camera is fine, already checked it, such solutions were available in the other questions as well (which i did mention I already tried) – udion Dec 21 '17 at 11:33