一、开发环境
主板操作系统:buildroot;
摄像头:USB双目摄像头,RGB+IR;
二、调试
1、连接摄像头
将摄像头USB口连接到主板,主板输出如下日志:
[ 1886.480437] usb 1-1: new high-speed USB device number 3 using ehci-platform
[ 1886.628815] usb 1-1: New USB device found, idVendor=1a40, idProduct=0801, bcdDevice= 1.00
[ 1886.628902] usb 1-1: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[ 1886.628933] usb 1-1: Product: USB 2.0 Hub
[ 1886.631121] hub 1-1:1.0: USB hub found
[ 1886.631434] hub 1-1:1.0: 4 ports detected
[ 1886.913823] usb 1-1.1: new high-speed USB device number 4 using ehci-platform
[ 1887.049748] usb 1-1.1: New USB device found, idVendor=2ab8, idProduct=a101, bcdDevice= 2.00
[ 1887.049829] usb 1-1.1: New USB device strings: Mfr=3, Product=1, SerialNumber=2
[ 1887.049861] usb 1-1.1: Product: RGB Camera
[ 1887.049888] usb 1-1.1: Manufacturer: RGB
[ 1887.049915] usb 1-1.1: SerialNumber: 20221029
[ 1887.056109] uvcvideo: Found UVC 1.00 device RGB Camera (2ab8:a101)
[ 1887.140322] usb 1-1.2: new服务器托管网 high-speed USB device number 5 using ehci-platform
[ 1887.274253] usb 1-1.2: New USB device found, idVendor=2ab8, idProduct=c101, bcdDevice= 1.00
[ 1887.274341] usb 1-1.2: New USB device strings: Mfr=3, Product=1, SerialNumber=2
[ 1887.274373] usb 1-1.2: Product: IR Camera
[ 1887.274401] usb 1-1.2: Manufacturer: IR
[ 1887.274427] usb 1-1.2: SerialNumber: 20201028
[ 1887.279080] uvcvideo: Found UVC 1.00 device IR Camera (2ab8:c101)
从日志可以看出发现了两个uvcvideo。
2、v4l2查看摄像头
查看设备名称和路径
root@rk3566-buildroot:v4l2-ctl --list-devices
RGB Camera: RGB Camera (usb-fd800000.usb-1.1):
/dev/video9
/dev/video10
/dev/media1
IR Camera: IR Camera (usb-fd800000.usb-1.2):
/dev/video11
/dev/video12
/dev/media2
名称分别是RGB Camera和IR Camera,路径为/dev/video9和/dev/video11。
查看设备的所有参数
v4l2-ctl -d /dev/video9 –all
查看支持的分辨率
v4l2-ctl –list-framesizes=MJPG -d /dev/video9
设置手动曝光
v4l2-ctl-d/dev/video9–set-ctrl=exposure_auto=1
设置曝光值
v4l2-ctl-d/dev/video9 –set-ctrl=exposure_absolute=9
3、预览图像
使用系统自带的脚本文件/rockchip-test/camera/camera_usb_test.sh,脚本内容:
#!/bin/bash
#export GST_DEBUG=*:5
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/gstreamer-1.0
v4l2-ctl --list-devices > /tmp/.v4l2_list
USB_VIDEO=($(awk '/usb/{getline a;print a}' /tmp/.v4l2_list))
echo "Found ${#USB_VIDEO[@]} USB Cameras"
rm /tmp/.v4l2_list
for i in USB_VIDEO
do
eval value=${${i}[@]}
for j in $value
do
echo "Start Preview USB Camera Video Path $j By GStreamer"
gst-launch-1.0 v4l2src device="$j" ! image/jpeg! jpegparse ! mppjpegdec ! waylandsink sync=false
done
done
执行脚本预览摄像头画面。
输入命令./camera_usb_test.sh,日志:
Found 2 USB Cameras
Start Preview USB Camera Video Path /dev/video9 By GStreamer
Setting pipeline to PAUSED ...
Pipeline is live and does not need PR服务器托管网EROLL ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Redistribute latency...
^Chandling interrupt.
Interrupt: Stopping pipeline ...
Execution ended after 0:00:19.191745178
Setting pipeline to NULL ...
Freeing pipeline ...
Start Preview USB Camera Video Path /dev/video11 By GStreamer
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Redistribute latency...
^Chandling interrupt.
Interrupt: Stopping pipeline ...
Execution ended after 0:00:17.421100043
Setting pipeline to NULL ...
Freeing pipeline ...
会显示发现的USB Camera数量,显示屏会显示第一个摄像头的图像,输入Ctrl+C会显示第二个摄像头的图像,再按下Ctrl+C退出图像预览。
v4l2使用说明:https://www.cnblogs.com/embedded-linux/p/5994860.html
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
分布式搜索引擎01 – elasticsearch基础 0.学习目标 1.初识elasticsearch 1.1.了解ES 1.1.1.elasticsearch的作用 elasticsearch是一款非服务器托管网常强大的开源搜索引擎,具备非常多强大功能,可…