Firefly开源社区

标题: RK3568J的开发板在Linux下面使用双目镱头抓图 [打印本页]

作者: harryhe    时间: 2022-2-8 15:31
标题: RK3568J的开发板在Linux下面使用双目镱头抓图
RK3568J的开发板在Linux下面使用双目镱头抓图
这个我也改成了这个
//#include "rk3568-firefly-aioj-cam-8ms1m.dtsi"
#include "rk3568-firefly-aioj-cam-2ms2m.dtsi"

/ {
    model = "AIO-3568J HDMI (Linux)";
    compatible = "rockchip,rk3568-firefly-aioj", "rockchip,rk3568";

};


使用这个命令抓图YUV
v4l2-ctl --verbose -d /dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat='NV12' --stream-mmap=4 --set-selection=target=crop,flags=0,top=0,left=0,width=1920,height=1080 --stream-to=/data/out.yuv

使用这个命令抓图YUV
[root@RK356X:/home/NfsRoot]# cat cap.sh
v4l2-ctl --verbose -d /dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat='NV12' --stream-mmap=4 --set-selection=target=crop,flags=0,top=0,left=0,width=1920,height=1080 --stream-to=/home/NfsRoot/out.yuv

[root@RK356X:/home/NfsRoot]# ./cap.sh
VIDIOC_QUERYCAP: ok
VIDIOC_G_FMT: ok
VIDIOC_S_FMT: failed: Device or resource busy
[  118.439138] rVIDIOC_G_SELECTION: ok
VIDIOkC_S_SELECTION: failed: Inapprcopriate ioctl for device
if_mipi_lvds: rkcif_s_fmt_vid_cap_mplane queue busy
[root@RK356X:/home/NfsRoot]#

就是这个提示,不知是什么原因,请大家帮忙看看!谢谢!


作者: Liuth    时间: 2022-2-8 16:06
双目摄像头对应的video是video5和14,不是0,单目才是video0
先用自带qcamera应用测试摄像头是否正常,再把你抓图命令中的video0改为5或14
作者: harryhe    时间: 2022-2-8 16:49
抓取了图YUV数据   

图像有这个花的是什么原因呢
作者: harryhe    时间: 2022-2-8 16:52
有几帧是正常的,中图这有样的数据

作者: harryhe    时间: 2022-3-4 17:42
本帖最后由 harryhe 于 2022-3-5 09:50 编辑

v4l2-ctl --verbose -d /dev/video14 --set-fmt-video=width=1920,height=1080,pixelformat='NV12' --stream-mmap=4 --set-selection=target=crop,flags=0,top=0,left=0,width=1920,height=1080 --stream-to=/home/NfsRoot/out.yuv

v4l2-ctl --verbose -d /dev/video5 --set-fmt-video=width=1920,height=1080,pixelformat='NV12' --stream-mmap=4 --set-selection=target=crop,flags=0,top=0,left=0,width=1920,height=1080 --stream-to=/home/NfsRoot/out.yuv

都是同样的效果,是花的

作者: Liuth    时间: 2022-3-5 09:52
是什么系统?buildroot 和 ubuntu20 按照维基先预览摄像头看是否正常工作 ,ubunu18不支持双目
https://wiki.t-firefly.com/Core- ... u-lan-she-xiang-tou

确认预览没问题后再抓图,用
v4l2-ctl -d /dev/video0  --try-fmt-video=width=1920,height=1080,pixelformat=NV12 --stream-mmap=3 --stream-to=test.yuv --stream-count=10 --stream-poll
作者: harryhe    时间: 2022-3-5 10:07
我使用的是buildroot  rootfs系统,现在是双目的镱头
双目的是 /dev/video14   /dev/video4   
我通过hdmi  qtCamera  可以显示视频的
作者: harryhe    时间: 2022-3-5 10:19

抓出来的图片还是不能播放

作者: Liuth    时间: 2022-3-5 15:34
不好意思,我之前说的命令是错的,用下面这个,我这里试验没问题:
v4l2-ctl --verbose -d /dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat='NV12' --stream-mmap=4 --set-selection=target=crop,flags=0,top=0,left=0,width=1920,height=1080 --stream-to=/data/out.yuv

文件取出来在ubuntu电脑上使用ffplay或者mplayer播放(因为板子上不带这两个播放器)
ffplay -f rawvideo -video_size 1920x1080 -pix_fmt nv12 out.yuv
mplayer -demuxer rawvideo -rawvideo w=1920:h=1080:format=NV12 out.yuv
作者: harryhe    时间: 2022-3-5 17:17
Liuth 发表于 2022-3-5 15:34
不好意思,我之前说的命令是错的,用下面这个,我这里试验没问题:
v4l2-ctl --verbose -d /dev/video0 -- ...

我是双目镱头,你是单目镱头对吗
作者: harryhe    时间: 2022-3-5 17:20
我的双目镱头用的是  /dev/video14   或 5    都不对
作者: Liuth    时间: 2022-3-7 09:00
我用的也是双目,用 grep -H '' /sys/class/video4linux/video*/name 命令可以查看
mainpath对应的video设备就是摄像头




欢迎光临 Firefly开源社区 (https://dev.t-firefly.com/) Powered by Discuz! X3.1