nvidia tx2平台 Allied vision Alvium相机调试1

free-jdx 2021-08-04 11:09:42 5048

1. 前言

2. v4l2-ctl 中断采集

3. v4l2-ctl查询

4. pipeline问题
1. 前言

最近购买了一个allied vision alvium相机,
并通过CSI2连接到板
想用OpenCV写一个简单的c++代码。

cv::VideoCapture capvid ;
cv::Mat frame;
std::string pipeline = “v4l2-ctl -d /dev/video0 --set-fmt-video=width=720,height=544, --set-ctrl bypass_mode=0 --stream-mmap --stream-count=600”;
capvid.open(pipeline, cv::CAP_V4L2);
capvid>>frame;
cv::imshow(“input”,frame);

输出帧的高度和宽度为0

2. v4l2-ctl 终端采集

当在终端中运行

v4l2-ctl -d /dev/video0——set-fmt-video=width=720,height=544,
——stream-mmap——stream-count=600

得到了这个输出

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 184.00 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<<<<<<<<<<<<<<<<<< 183.50 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 183.33 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

这是对gst-inspect-1.0的输出

**libav:  avenc_nellymoser: libav Nellymoser Asao encoder**
**libav:  avenc_mp2fixed: libav MP2 fixed point (MPEG audio layer 2) encoder**
**libav:  avenc_mp2: libav MP2 (MPEG audio layer 2) encoder**
**libav:  avenc_mlp: libav MLP (Meridian Lossless Packing) encoder**
**libav:  avenc_g723_1: libav G.723.1 encoder**
**libav:  avenc_eac3: libav ATSC A/52 E-AC-3 encoder**
**libav:  avenc_dca: libav DCA (DTS Coherent Acoustics) encoder**
**libav:  avenc_alac: libav ALAC (Apple Lossless Audio Codec) encoder**
**libav:  avenc_ac3_fixed: libav ATSC A/52A (AC-3) encoder**
**libav:  avenc_ac3: libav ATSC A/52A (AC-3) encoder**
**libav:  avenc_aac: libav AAC (Advanced Audio Coding) encoder**
**libav:  avenc_s302m: libav SMPTE 302M encoder**
**libav:  avenc_comfortnoise: libav RFC 3389 comfort noise generator encoder**
**pcapparse:  irtspparse: IRTSPParse**
**pcapparse:  pcapparse: PCapParse**
**faceoverlay:  faceoverlay: faceoverlay**
**asf:  rtpasfdepay: RTP ASF packet depayloader**
**asf:  rtspwms: WMS RTSP Extension**
**asf:  asfdemux: ASF Demuxer**
**a52dec:  a52dec: ATSC A/52 audio decoder**
**faad:  faad: AAC audio decoder**
**x265:  x265enc: x265enc**
**curl:  curlhttpsrc: HTTP Client Source using libcURL**
**curl:  curlsmtpsink: Curl smtp sink**
**curl:  curlftpsink: Curl ftp sink**
**curl:  curlfilesink: Curl file sink**
**curl:  curlhttpsink: Curl http sink**
**audiolatency:  audiolatency: AudioLatency**
**realmedia:  pnmsrc: PNM packet receiver**
**realmedia:  rtspreal: RealMedia RTSP Extension**
**realmedia:  rdtmanager: RTP Decoder**
**realmedia:  rdtdepay: RDT packet parser**
**realmedia:  rademux: RealAudio Demuxer**
**realmedia:  rmdemux: RealMedia Demuxer**
**hls:  hlssink2: HTTP Live Streaming sink**
**hls:  hlssink: HTTP Live Streaming sink**
**hls:  hlsdemux: HLS Demuxer**
**amrwbdec:  amrwbdec: AMR-WB audio decoder**
**gdp:  gdppay: GDP Payloader**
**gdp:  gdpdepay: GDP Depayloader**
**openexr:  openexrdec: OpenEXR decoder**
**coloreffects:  chromahold: Chroma hold filter**
**coloreffects:  coloreffects: Color Look-up Table filter**
**mpegtsdemux:  tsdemux: MPEG transport stream demuxer**
**mpegtsdemux:  tsparse: MPEG transport stream parser**
**openglmixers:  glstereomix: OpenGL stereo video combiner**
**openglmixers:  glvideomixerelement: OpenGL video_mixer**
**openglmixers:  glvideomixer: OpenGL video_mixer bin**
**openglmixers:  glmixerbin: OpenGL video_mixer empty bin**
**rtmp:  rtmpsink: RTMP output sink**
**rtmp:  rtmpsrc: RTMP Source**
**waylandsink:  waylandsink: wayland video sink**
**mpeg2dec:  mpeg2dec: mpeg1 and mpeg2 video decoder**
**sid:  siddec: Sid decoder**
**videosignal:  simplevideomark: Video marker**
**videosignal:  simplevideomarkdetect: Video detecter**
**videosignal:  videoanalyse: Video analyser**
**ipcpipeline:  ipcslavepipeline: Inter-process slave pipeline**
**ipcpipeline:  ipcpipelinesink: Inter-process Pipeline Sink**
**ipcpipeline:  ipcpipelinesrc: Inter-process Pipeline Source**
**audiomixmatrix:  audiomixmatrix: Matrix audio mix**
**fbdevsink:  fbdevsink: fbdev video sink**
**bs2b:  bs2b: Crossfeed effect**
**kms:  kmssink: KMS video sink**
**dashdemux:  dashdemux: DASH Demuxer**
**bluez:  avdtpsrc: Bluetooth AVDTP Source**
**bluez:  avdtpsink: Bluetooth AVDTP sink**
**bluez:  a2dpsink: Bluetooth A2DP sink**
**webrtcdsp:  webrtcechoprobe: Accoustic Echo Canceller probe**
**webrtcdsp:  webrtcdsp: Voice Processor (AGC, AEC, filters, etc.)**
**stereo:  stereo: Stereo effect**
**bayer:  rgb2bayer: RGB to Bayer converter**
**bayer:  bayer2rgb: Bayer to RGB decoder for cameras**
**webrtc:  webrtcbin: WebRTC Bin**
**interlace:  interlace: Interlace filter**
**rfbsrc:  rfbsrc: Rfb source**
**ofa:  ofa: OFA**
**ivfparse:  ivfparse: IVF parser**
**staticelements:  bin: Generic bin**
**staticelements:  pipeline: Pipeline object**

**Total count: 260 plugins, 1424 features**
3. v4l2-ctl查询
v4l2-ctl --list-formats-ext -d /dev/video0 returned the following output
ioctl: VIDIOC_ENUM_FMT
** Index : 0**
** Type : Video Capture**
** Pixel Format: ‘TP31’**
** Name : 0x31 MIPI DATATYPE**
** Size: Discrete 720x544**
** Interval: Discrete 0.005s (183.831 fps)**
** Index : 1**
** Type : Video Capture**
** Pixel Format: ‘GREY’**
** Name : 8-bit Greyscale**
** Size: Discrete 720x544**
** Interval: Discrete 0.005s (183.831 fps)**
** Index : 2**
** Type : Video Capture**
** Pixel Format: ‘J2Y0’**
** Name : 10-bit/16-bit Greyscale**
** Size: Discrete 720x544**
** Interval: Discrete 0.005s (183.831 fps)**
** Index : 3**
** Type : Video Capture**
** Pixel Format: ‘J2Y2’**
** Name : 12-bit/16-bit Greyscale**
** Size: Discrete 720x544**
** Interval: Discrete 0.005s (183.831 fps)**
** Index : 4**
** Type : Video Capture**
** Pixel Format: ‘BX24’**
** Name : 32-bit XRGB 8-8-8-8**
** Size: Discrete 720x544**
** Interval: Discrete 0.005s (183.831 fps)**
** Index : 5**
** Type : Video Capture**
** Pixel Format: ‘XR24’**
** Name : 32-bit BGRX 8-8-8-8**
** Size: Discrete 720x544**
** Interval: Discrete 0.005s (183.831 fps)**
** Index : 6**
** Type : Video Capture**
** Pixel Format: ‘VYUY’**
** Name : VYUY 4:2:2**
** Size: Discrete 720x544**
** Interval: Discrete 0.005s (183.831 fps)**
4. pipeline问题

接收帧的管道应该是什么样的?
知道在为Gstreamer定义管道时,需要定义内存和格式。
对于V4L2管道,是否也需要做一些类似的事情?

管道仅用于gstreamer后端。
如果使用V4L后端,只需提供视频节点索引:

# Open /dev/video0
cap = cv2.VideoCapture(0, cv2.CAP_V4L2);
w = cap.get (cv2.CAP_PROP_FRAME_WIDTH)
h = cap.get (cv2.CAP_PROP_FRAME_HEIGHT)
fps = cap.get (cv2.CAP_PROP_FPS)

当我帧从cap转移到opencv Mat时,高度和宽度仍然是0
此外,相机有以下设置
有些在CAP_PROP中是不可用的
有办法改变这些参数吗?
理想情况下,需要使用低延迟模式

用户控件

                brightness 0x00980900 (int)    : min=0 max=255 step=1 default=0 value=0 flags=slider
                      gamma 0x00980910 (int)    : min=40 max=240 step=5 default=100 value=100 flags=slider
                   exposure 0x00980911 (int)    : min=164263 max=2147483647 step=16667 default=4997596 value=4897691 flags=slider
                  auto_gain 0x00980912 (bool)   : default=0 value=0
                       gain 0x00980913 (int)    : min=0 max=2400 step=10 default=0 value=0 flags=slider
                  reverse_x 0x00980914 (bool)   : default=0 value=0
                  reverse_y 0x00980915 (bool)   : default=0 value=0
      frame_timeout_enabled 0x009809c8 (bool)   : default=1 value=1
              frame_timeout 0x009809c9 (int)    : min=100 max=12000 step=1 default=12000 value=12000
   stride_alignment_enabled 0x009809ca (bool)   : default=1 value=1
     crop_alignment_enabled 0x009809cb (bool)   : default=1 value=1

相机控件

          exposure_auto 0x009a0901 (menu)   : min=0 max=1 default=1 value=1
          exposure_absolute 0x009a0902 (int64)  : min=1 max=100000 step=1 default=1 value=49
              auto_gain_min 0x009a092a (int)    : min=0 max=0 step=10 default=0 value=0 flags=slider
              auto_gain_max 0x009a092b (int)    : min=0 max=2400 step=10 default=2400 value=2400 flags=slider
                bypass_mode 0x009a2064 (intmenu): min=0 max=1 default=0 value=0
            override_enable 0x009a2065 (intmenu): min=0 max=1 default=0 value=0
               height_align 0x009a2066 (int)    : min=1 max=16 step=1 default=1 value=1
                 size_align 0x009a2067 (intmenu): min=0 max=2 default=0 value=0
           write_isp_format 0x009a2068 (int)    : min=1 max=1 step=1 default=1 value=1
   sensor_signal_properties 0x009a2069 (u32)    : min=0 max=4294967295 step=1 default=0 [30][18] flags=read-only, has-payload
    sensor_image_properties 0x009a206a (u32)    : min=0 max=4294967295 step=1 default=0 [30][16] flags=read-only, has-payload
  sensor_control_properties 0x009a206b (u32)    : min=0 max=4294967295 step=1 default=0 [30][36] flags=read-only, has-payload
          sensor_dv_timings 0x009a206c (u32)    : min=0 max=4294967295 step=1 default=0 [30][16] flags=read-only, has-payload
           low_latency_mode 0x009a206d (bool)   : default=0 value=0
           preferred_stride 0x009a206e (int)    : min=0 max=65535 step=1 default=0 value=0
               sensor_modes 0x009a2082 (int)    : min=0 max=30 step=1 default=30 value=1 flags=read-only
声明:本文内容由易百纳平台入驻作者撰写,文章观点仅代表作者本人,不代表易百纳立场。如有内容侵权或者其他问题,请联系本站进行删除。
free-jdx
红包 93 收藏 评论 打赏
评论
0个
内容存在敏感词
手气红包
    易百纳技术社区暂无数据
相关专栏
置顶时间设置
结束时间
删除原因
  • 广告/SPAM
  • 恶意灌水
  • 违规内容
  • 文不对题
  • 重复发帖
打赏作者
易百纳技术社区
free-jdx
您的支持将鼓励我继续创作!
打赏金额:
¥1易百纳技术社区
¥5易百纳技术社区
¥10易百纳技术社区
¥50易百纳技术社区
¥100易百纳技术社区
支付方式:
微信支付
支付宝支付
易百纳技术社区微信支付
易百纳技术社区
打赏成功!

感谢您的打赏,如若您也想被打赏,可前往 发表专栏 哦~

举报反馈

举报类型

  • 内容涉黄/赌/毒
  • 内容侵权/抄袭
  • 政治相关
  • 涉嫌广告
  • 侮辱谩骂
  • 其他

详细说明

审核成功

发布时间设置
发布时间:
是否关联周任务-专栏模块

审核失败

失败原因
备注
拼手气红包 红包规则
祝福语
恭喜发财,大吉大利!
红包金额
红包最小金额不能低于5元
红包数量
红包数量范围10~50个
余额支付
当前余额:
可前往问答、专栏板块获取收益 去获取
取 消 确 定

小包子的红包

恭喜发财,大吉大利

已领取20/40,共1.6元 红包规则

    易百纳技术社区