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

From RidgeRun Developer Wiki
m (Remove double title)
m (Update navigation)
Line 47: Line 47:


<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>

Revision as of 21:04, 10 March 2021



Previous: Examples/Using Gstd Index Next: Examples/Other 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 this page

Once the calibration tool is executed you will have a CAMERA_MATRIX and DISTORTION_PARAMETERS for each camera.

Capture to Display

This examples showcases the basic use of the undistort element.

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

Camera stitching with undistort element

This comprises of a system with both undistortion and stitching for three camera inputs.

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


Previous: Examples/Using Gstd Index Next: Examples/Other pipelines