2013-03-08 48 views
0

我在我的ubuntu pc上安裝了庫opencv,我編寫了一個程序,它從網絡攝像頭獲取視頻並且可以工作。opencv highgui error

昨天我安裝了視頻採集驅動程序「media_build」從視頻採集卡中採集視頻,但是同一個程序不起作用,而如果我在VLC上打開「video for linux 2」,它就可以工作。

這是錯誤:

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

的指令是:

CvCapture* capture = cvCaptureFromCAM(CV_CAP_ANY);

什麼建議嗎? 謝謝

+0

嘗試[詢問的Ubuntu(http://askubuntu.com/)。 – 2013-03-08 17:40:11

回答

1

我認爲你的程序崩潰了。如果是這樣,你可以添加if(capture!=NULL) {// your normal code here}else{// display some error message}。在這種情況下,程序不會崩潰。可能你的視頻驅動程序沒有提供openCv已知的接口。

+0

謝謝,所以沒有解決方案? – user2023431 2013-03-08 19:29:20

0

也許你可以使用這個命令:

sudo chmod 666 /dev/video0 
相關問題