Changes

Jump to navigation Jump to search
Line 405: Line 405:     
====== preferred_stride ======
 
====== preferred_stride ======
preferred_stride指一行图像数据需要的内存大小。
+
preferred_stride指一行图像数据需要的内存大小。Jetson平台的图像数据是unpacked存储的,即10bit depth和12 bit depth的数据格式下,一个像素占用两个字节。
    
* 普通情况下,buffer需要64字节对齐。
 
* 普通情况下,buffer需要64字节对齐。
   −
preferred_stride= ALIGN_UP(width*bit_depth/8,64)
+
preferred_stride= ALIGN_UP(width*bytes_per_pixel,64)
   −
比如GREY模式下3088宽度,preferred_stride=3104。
+
比如宽度为3088时:
 +
 
 +
8bit depth,preferred_stride=3136。
 +
 
 +
10bit depth,preferred_stride=6208。
 +
 
 +
12bit depth,preferred_stride=6208。
    
* 如果使用VIC buffer,则需要256字节对齐。
 
* 如果使用VIC buffer,则需要256字节对齐。
   −
preferred_stride= ALIGN_UP(width*bit_depth/8,256)
+
preferred_stride= ALIGN_UP(width*bytes_per_pixel,256)
    
==== 流模式 ====
 
==== 流模式 ====
Line 433: Line 439:  
* raw8格式
 
* raw8格式
   −
<code>v4l2-ctl --set-fmt-video=width=3088,height=2064,pixelformat=GREY --stream-mmap --stream-count=1 --stream-to=y8-3104x2064.raw</code>
+
<code>v4l2-ctl -d /dev/video0 --set-ctrl preferred_stride=3136</code>
 +
 
 +
<code>v4l2-ctl --set-fmt-video=width=3088,height=2064,pixelformat=GREY --stream-mmap --stream-count=1 --stream-to=y8-3136x2064.raw</code>
    
或者
 
或者
   −
<code>./yavta -c1 -Fy8-3104x2064.raw --skip 0 -f Y8 -s 3088x2064 /dev/video0</code>
+
<code>./yavta -c1 -Fy8-3136x2064.raw --skip 0 -f Y8 -s 3088x2064 /dev/video0</code>
    
* raw10格式
 
* raw10格式
   −
<code>v4l2-ctl --set-fmt-video=width=3088,height=2064,pixelformat=XY10 --stream-mmap --stream-count=1 --stream-to=y10-3088x2064.raw</code>
+
<code>v4l2-ctl -d /dev/video0 --set-ctrl preferred_stride=6208</code>
 +
 
 +
<code>v4l2-ctl --set-fmt-video=width=3088,height=2064,pixelformat=XY10 --stream-mmap --stream-count=1 --stream-to=y10-3104x2064.raw</code>
    
* raw12格式
 
* raw12格式
   −
<code>v4l2-ctl --set-fmt-video=width=3088,height=2064,pixelformat=XY12 --stream-mmap --stream-count=1 --stream-to=y12-3088x2064.raw</code>
+
<code>v4l2-ctl -d /dev/video0 --set-ctrl preferred_stride=6208</code>
 +
 
 +
<code>v4l2-ctl --set-fmt-video=width=3088,height=2064,pixelformat=XY12 --stream-mmap --stream-count=1 --stream-to=y12-3104x2064.raw</code>
    
图片格式请参考下面:raw data图片格式说明 章节。
 
图片格式请参考下面:raw data图片格式说明 章节。

Navigation menu