Linux下學習攝像頭使用


剛接觸Linux硬件驅動有關的項目,配置攝像頭經歷的一些操作

(這篇文章是剛接觸Linux下V4L時作為記錄記下的,感覺只有幾個命令還有參考作用)                               

一 確定攝像頭種類

確定是否符合UVC標准協議,一般Linux 2.6.3(好像是,不用在意)以上的版本都在內核集成了。

1.lsusb

使用這條命令能看到USB有關設備。lsusb -v | grep "14 Video",打印信息如下:

bFunctionClass 14 Video
bInterfaceClass 14 Video
bInterfaceClass 14 Video
bInterfaceClass 14 Video
bInterfaceClass 14 Video

說明是支持UVC的攝像頭

2.dmesg

剛插入攝像頭的打印信息如下:

[17102.026976] usb 3-4: new high-speed USB device number 23 using xhci_hcd
[17102.155595] usb 3-4: New USB device found, idVendor=1908, idProduct=2311
[17102.155603] usb 3-4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[17102.155606] usb 3-4: Product: USB2.0 PC CAMERA
[17102.155610] usb 3-4: Manufacturer: Generic
[17102.156147] uvcvideo: Found UVC 1.00 device USB2.0 PC CAMERA (1908:2311)
[17102.156690] input: USB2.0 PC CAMERA as /devices/pci0000:00/0000:00:14.0/usb3/3-4/3-4:1.0/input/input29

暫時不知道這信息怎么使用。 (1908:2311)這個信息是可以在http://www.ideasonboard.org/uvc/查詢是否支持UVC的(然而我沒找到自己這攝像相應的,但其實也是支持UVC的)。

二 注意攝像頭加載的文件位置。

http://blog.csdn.net/linczone/article/details/48342419(這是一篇如何使usb設備創建指定設備名的博客,暫時未懂也還用不上,以后學習)

攝像頭加載到/dev/video*上。通過攝像頭插入前后對比知道了攝像頭的設備文件名。

三 已有的支持攝像頭的軟件

luvcview

webcam

spcaview

xawtv

可以通過apt-get install直接安裝,也可以嘗試自主編譯源碼,由於嵌入式開發交叉編譯需要,我必須嘗試自主編譯源碼。

四 編譯軟件源碼(通過apt-get更方便)

 luvcview

1.luvcview編譯缺少庫文件支持

SDL與linux/videodev.h

SDL(Simple DirectMedia Layer)在網上下載安裝。

linux/videodev.h解決方案:

方案1:(其實是有問題的,編譯不通過)

sudo apt-get install libv4l-dev 

sudo ln -s /usr/include/libv4l1-videodev.h /usr/include/linux/videodev.h

方案2:

sudo ln -s /usr/include/linux/videodev2.h /usr/include/linux/videodev.h

2.啟動luvcview報錯(未解決)

luvcview 0.2.6

Couldn't initialize SDL: No available video device

xawtv-3.95

1.make 問題

問題一 :Oops: (n)curses library not found. You need this one, please install.

 sudo apt-get install libncurses5-dev

問題二:jpeg library not found. 

sudo apt-get install libjpeg-dev    

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM