0
votes

I installed the library opencv in my ubuntu pc and i wrote a program that takes a video from a webcam and it works.

Yesterday I installed the driver for video capture "media_build" to take a video from a video grabber, but the same program doesn't work, while if I open "video for linux 2" on VLC it works.

This is the error:

libv4l2: error set_fmt gave us a different result then try_fmt! HIGHGUI ERROR: libv4l unable convert to requested pixfmt
HIGHGUI ERROR: V4L: device /dev/video0: Unable to query number of channels
ERROR: capture is NULL

The instruction is:

CvCapture* capture = cvCaptureFromCAM( CV_CAP_ANY );

any suggestion? thanks

2

2 Answers

1
votes

I think your program is crashing. If so you can add if(capture!=NULL) {// your normal code here}else{// display some error message}. In this case the program wont crash. Probably your video driver isn't providing a interface known to openCv.

0
votes

Maybe you can use this command:

sudo chmod 666 /dev/video0