Changes

Jump to navigation Jump to search
Line 408: Line 408:  
<code>v4l2-ctl --set-fmt-video=width=3088,height=2064,pixelformat=GREY</code>
 
<code>v4l2-ctl --set-fmt-video=width=3088,height=2064,pixelformat=GREY</code>
   −
The maximum frame rate will be adjusted automatically after setting ROI. Please note that the camera roi parameters need to comply with the requirements in the camera manual.
+
The maximum frame rate will be adjusted automatically after setting ROI. Please note that the camera ROI parameters need to comply with the requirements in the camera manual.
    
====== preferred_stride ======
 
====== preferred_stride ======
 +
The preferred_stride refers to the memory size required for one line of image data. Image data for the Jetson platform is stored unpacked, i.e., one pixel occupies two bytes in the 10-bit depth and 12-bit depth data formats.
 +
 +
* In the normal case, the buffer needs to be 64 bytes aligned.
 +
 +
preferred_stride= ALIGN_UP(width*bytes_per_pixel,64)
 +
 +
For instance, if the width is 3088:
 +
 +
8bit depth,preferred_stride=3136;
 +
 +
10bit depth,preferred_stride=6208;
 +
 +
12bit depth,preferred_stride=6208;
 +
 +
* If VIC buffer is used, 256 bytes alignment is required.
 +
 +
preferred_stride= ALIGN_UP(width*bytes_per_pixel,256)
 +
==== Video Streaming mode====
 +
=====Set ROI and format=====
 +
Take MV-MIPI-IMX178M, 3088*2064 as an example.
 +
 +
<code>v4l2-ctl --set-ctrl roi_x=0</code>
 +
 +
<code>v4l2-ctl --set-ctrl roi_y=0</code>
 +
 +
<code>v4l2-ctl --set-fmt-video=width=3088,height=2064,pixelformat=GREY</code>
 +
=====Frame rate statistics=====
 +
In streaming mode, the following commands can be used for frame rate statistics.
 +
 +
<code>v4l2-ctl --set-fmt-video=width=3088,height=2064,pixelformat=GREY --stream-mmap --stream-count=-1 --stream-to=/dev/null</code>
 +
 +
===== Save image to file =====
 +
 +
*raw8
 +
 +
<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>
 +
 +
or
 +
 +
<code>./yavta -c1 -Fy8-3136x2064.raw --skip 0 -f Y8 -s 3088x2064 /dev/video0</code>
 +
 +
* raw10
 +
 +
<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
 +
 +
<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>
 +
 +
For the image format, please refer to the section above: Description of raw data image format.
 +
=====Preview=====
 +
The camera can be previewed in real time using the following command:
 +
 +
<code>v4l2-ctl --set-fmt-video=width=2816,height=2064,pixelformat=UYVY</code>
 +
 +
<code>gst-launch-1.0 v4l2src device=/dev/video0 ! "video/x-raw,format=(string)UYVY, width=(int)2816, height=(int)2064, framerate=(fraction)22/1" ! nvvidconv ! "video/x-raw(memory:NVMM),format=(string)I420" ! nvoverlaysink sync=false</code>
 +
 +
The maximum width supported by UYVY mode is 2880.
 +
 +
==== Trigger mode(Using v4l2-ctl) ====
 +
 +
===== Prepare =====
 +
Take MV-MIPI-IMX178M, 3088*2064 as an example.
 +
 +
<code>v4l2-ctl --set-ctrl roi_x=0</code>
 +
 +
<code>v4l2-ctl --set-ctrl roi_y=0</code>
 +
 +
<code>v4l2-ctl --set-ctrl low_latency_mode=1</code>
 +
 +
<code>v4l2-ctl --set-fmt-video=width=3088,height=2064,pixelformat=GREY</code>
 +
 +
<code>v4l2-ctl -d /dev/video0 --set-ctrl preferred_stride=3136</code>
 +
=====Software trigger mode =====
 +
======Set mode======
 +
<code>v4l2-ctl --set-ctrl <small>trigger_mode=1</small></code>
 +
 +
<code>v4l2-ctl --set-ctrl <small>trigger_src=0</small></code>
 +
 +
<code>v4l2-ctl --set-ctrl vi_time_out_disable=1</code>
 +
======Start acquisition======
 +
<code>v4l2-ctl --set-fmt-video=width=3088,height=2064,pixelformat=GREY --stream-mmap --stream-count=-1 --stream-to=y8-3104x2064.raw</code>
 +
====== Perform soft trigger operation ======
 +
In other shell terminals, you can execute the following command multiple times for multiple triggers.
 +
 +
<code>v4l2-ctl --set-ctrl <small>soft_trgone=1</small></code>
 +
 +
====== Stop triggering and capturing ======
 +
Since the kernel driver is waiting for new images, you need to cancel vi_time_out_disable before exiting the acquisition operation.
 +
 +
<code>v4l2-ctl --set-ctrl vi_time_out_disable=0</code>
 +
 +
In the terminal of the acquisition command, press Ctrl+C to exit the acquisition operation.
 +
 +
===== Hardware trigger mode =====
 +
To use [https://github.com/NVIDIA/jetson-gpio jetson-gpio] for trigger operation, please install and configure jetson-gpio first.
 +
 +
The following is an example of using jetson GPIO40 (Board number) as the trigger source and rising edge triggering.
 +
 +
You can use the [[Mv mipi i2c.sh user guide|mv_mipi_i2c.sh]] script to set other trigger parameters.
 +
 +
====== Hardware Connection ======
 +
<br />[[File:MV camera hardware trigger connection.jpg|center|thumb|800x800px|MV camera hardware trigger connection|link=http://wiki.veye.cc/index.php/File:MV_camera_hardware_trigger_connection.jpg]]<br />
 +
======Set mode======
 +
<code>v4l2-ctl --set-ctrl <small>trigger_mode=1</small></code>
 +
 +
<code>v4l2-ctl --set-ctrl <small>trigger_src=1</small></code>
 +
 +
<code>v4l2-ctl --set-ctrl vi_time_out_disable=1</code>
 +
======Start acquisition======
 +
<code>v4l2-ctl --set-fmt-video=width=3088,height=2064,pixelformat=GREY --stream-mmap --stream-count=-1 --stream-to=y8-3104x2064.raw</code>
 +
 +
====== Perform hardware trigger operation ======
 +
<code>python gpio_trigger_jetson.py</code>
 +
 +
Note: script link.
 +
 +
====== Stop triggering and capturing ======
 +
Since the kernel driver is waiting for new images, you need to cancel vi_time_out_disable before exiting the acquisition operation.
 +
 +
<code>v4l2-ctl --set-ctrl vi_time_out_disable=0</code>
 +
 +
In the terminal of the acquisition command, press Ctrl+C to exit the acquisition operation.
 +
 +
==== Trigger mode(C demo) ====
 +
TODO
 +
 +
===i2c script for parameter configuration===
 +
We provide shell scripts to configure the parameters.
 +
 +
[http://wiki.veye.cc/index.php/Mv_mipi_i2c.sh_user_guide mv_mipi_i2c.sh user guide]
 +
===References===
 +
<br />
 +
===Document History===
 +
 +
*2022-05-19
 +
 +
Release 1st version.
 
<br />
 
<br />

Navigation menu