Image Stitching for NVIDIA Jetson/Examples/Undistort Pipelines: Difference between revisions

From RidgeRun Developer Wiki
m (Remove double title)
mNo edit summary
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
<noinclude>
<noinclude>
{{Image_Stitching_for_NVIDIA_Jetson/Head|previous=Examples/Using Gstd |next=Examples/Other pipelines|Image Stitching, CUDA, Stitcher, OpenCV, Panorama}}
{{Image_Stitching_for_NVIDIA_Jetson/Head|previous=Examples/Using Gstd |next=Examples/Other pipelines|metakeywords=Image Stitching, CUDA, Stitcher, OpenCV, Panorama}}
</noinclude>
</noinclude>


==Undistort pipelines==


Lens distortion correction can be applied to the stitcher with the undistort element, this page shows some basic usage examples, to learn more about the element and how to calibrate it, visit [https://developer.ridgerun.com/wiki/index.php?title=CUDA_Accelerated_GStreamer_Camera_Undistort/Getting_Started/Getting_the_code this page]
Lens distortion correction can be applied to the stitcher with the undistort element.  


Once the calibration tool is executed you will have a <code>CAMERA_MATRIX</code> and <code>DISTORTION_PARAMETERS</code> for each camera.
The [https://developer.ridgerun.com/wiki/index.php?title=CUDA_Accelerated_GStreamer_Camera_Undistort/Examples Undistort examples] wiki shows some basic usage examples. Visit [https://developer.ridgerun.com/wiki/index.php?title=CUDA_Accelerated_GStreamer_Camera_Undistort/Getting_Started/Getting_the_code this page] to learn more about the element and how to calibrate it.
 
=== Capture to Display ===
This examples showcases the basic use of the undistort element.
 
<syntaxhighlight lang=bash>
CAMERA_MATRIX="{\"fx\":2.8472876737532920e+03, \"fy\":2.8608529052506838e+03, \"cx\":9.7983673800322515e+02, \"cy\":5.0423299551699932e+02}"
DISTORTION_PARAMETERS="{\"k1\":-6.7260720359999060e-01, \"k2\":2.5160831522455513e+00, \"p1\":5.4007310542765141e-02, \"p2\":-1.1365265232659062e-02, \"k3\":-1.2760075297700798e+01 }"
 
gst-launch-1.0 nvarguscamerasrc ! cudaundistort distortion-model=brown-conrady camera-matrix=$CAMERA_MATRIX distortion-parameters=$DISTORTION_PARAMETERS ! nvoverlaysink
</syntaxhighlight>
 
=== Camera stitching with undistort element ===
 
This comprises of a system with both undistortion and stitching for three camera inputs.
 
<syntaxhighlight lang=bash>
OUTVIDEO=/tmp/stitching_result.mp4
 
CAMERA_MATRIX_1="{\"fx\":2.8472876737532920e+03, \"fy\":2.8608529052506838e+03, \"cx\":9.7983673800322515e+02, \"cy\":5.0423299551699932e+02}"
DISTORTION_PARAMETERS_1="{\"k1\":-6.7260720359999060e-01, \"k2\":2.5160831522455513e+00, \"p1\":5.4007310542765141e-02, \"p2\":-1.1365265232659062e-02, \"k3\":-1.2760075297700798e+01 }"
 
 
CAMERA_MATRIX_2="{\"fx\":2.8472876737532920e+03, \"fy\":2.8608529052506838e+03, \"cx\":9.7983673800322515e+02, \"cy\":5.0423299551699932e+02}"
DISTORTION_PARAMETERS_2="{\"k1\":-6.7260720359999060e-01, \"k2\":2.5160831522455513e+00, \"p1\":5.4007310542765141e-02, \"p2\":-1.1365265232659062e-02, \"k3\":-1.2760075297700798e+01 }"
 
 
CAMERA_MATRIX_3="{\"fx\":2.8472876737532920e+03, \"fy\":2.8608529052506838e+03, \"cx\":9.7983673800322515e+02, \"cy\":5.0423299551699932e+02}"
DISTORTION_PARAMETERS_3="{\"k1\":-6.7260720359999060e-01, \"k2\":2.5160831522455513e+00, \"p1\":5.4007310542765141e-02, \"p2\":-1.1365265232659062e-02, \"k3\":-1.2760075297700798e+01 }"
 
 
gst-launch-1.0 -e cudastitcher name=stitcher \
homography-list="`cat homographies.json | tr -d "\n" | tr -d " "`" \
border-width=$BORDER_WIDTH \
nvarguscamerasrc maxperf=true sensor-id=0 ! nvvidconv ! "video/x-raw(memory:NVMM), width=1920, height=1080" ! cudaundistort distortion-model=brown-conrady camera-matrix="$CAMERA_MATRIX_1" distortion-parameters="$DISTORTION_PARAMETERS_1" ! nvvidconv ! "video/x-raw(memory:NVMM), width=640, height=360" ! queue ! stitcher.sink_0 \
nvarguscamerasrc maxperf=true sensor-id=1 ! nvvidconv ! "video/x-raw(memory:NVMM), width=1920, height=1080" ! cudaundistort distortion-model=brown-conrady camera-matrix="$CAMERA_MATRIX_2" distortion-parameters="$DISTORTION_PARAMETERS_2" ! nvvidconv ! "video/x-raw(memory:NVMM), width=640, height=360" ! queue ! stitcher.sink_1 \
nvarguscamerasrc maxperf=true sensor-id=2 ! nvvidconv ! "video/x-raw(memory:NVMM), width=1920, height=1080" ! cudaundistort distortion-model=brown-conrady camera-matrix="$CAMERA_MATRIX_3" distortion-parameters="$DISTORTION_PARAMETERS_3" ! nvvidconv ! "video/x-raw(memory:NVMM), width=640, height=360" ! queue ! stitcher.sink_2 \
stitcher. ! perf print-arm-load=true ! queue ! nvvidconv ! "video/x-raw(memory:NVMM), width=1920, height=360" ! nvv4l2h264enc bitrate=20000000 ! h264parse ! mpegtsmux ! filesink location=$OUTVIDEO
</syntaxhighlight>


<noinclude>
<noinclude>
{{Image_Stitching_for_NVIDIA_Jetson/Foot|Examples|Examples/Using Gstd}}
{{Image_Stitching_for_NVIDIA_Jetson/Foot|Examples/Using Gstd|Examples/Other pipelines}}
</noinclude>
</noinclude>

Latest revision as of 17:37, 9 March 2023