Ask Your Question
0

cv2.VideoCapture(1) is causing errors. Please help me fix this.

asked 2017-08-01 16:00:09 -0600

tj gravatar image

this is the error: OpenCV Error: Assertion failed (scn == 3 || scn == 4) in cvtColor, file /build/opencv-SviWsf/opencv-2.4.9.1+dfsg/modules/imgproc/src/color.cpp, line 3737 Traceback (most recent call last): File "face_recognizer.py", line 157, in <module> gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) cv2.error: /build/opencv-SviWsf/opencv-2.4.9.1+dfsg/modules/imgproc/src/color.cpp:3737: error: (-215) scn == 3 || scn == 4 in function cvtColor

Also how do I know what to enter in the device id in videocapture().?

Thanks.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-08-02 08:58:07 -0600

Raki gravatar image

updated 2017-08-02 08:59:42 -0600

A wild guess: Is your capturing device actually capturing frames in the first place? Could you check it with:

VideoCapture cap(0); // open the default camera
if(!cap.isOpened())  // check if we succeeded
     cout<< "Something is wrong, I am not receiving anything!"<<endl;

More can be found here.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-08-01 16:00:09 -0600

Seen: 530 times

Last updated: Aug 02 '17