DriveWorks SDK Reference
3.0.4260 Release
For Test and Development only

Video Rectification Sample
Note
SW Release Applicability: This sample is available in both NVIDIA DriveWorks and NVIDIA DRIVE Software releases.

Description

The Video Rectification sample demonstrates how to remove fisheye distortion from a video captured on a camera with a fisheeye lens.

The sample reads frames from a video input recorded from an 180 fov camera and takes the calibration from the rig.json file. It then performs rectification and displays both the original and rectified video side-by-side.

Running the Sample

./sample_video_rectifier --video=[path/to/video]
                         --rig=[path/to/rig/file]
                         --camera-name=[string]
                         --fovX=[integer]
                         --fovY=[integer]
                         --record-video=[h264|h265|mp4]

where

--video=[path/to/video]
    Points to a recorded video.
    Default value: .././data/samples/sfm/triangulation/video_0.h264

--rig=[path/to/rig/file]
    Points to the rig file that contains calibration information.
    Default value: .././data/samples/sfm/triangulation/rig.json

--camera-name=[string]
    Is the camera name in the rig configuration file.
    Default value: SVIEW_FR

--fovX=[integer]
    Defines the field of view of the camera along the X axis.
    This property is only applicable to pinhole cameras.
    Default value: 120

--fovY=[integer]
    Defines the field of view of the camera along the Y axis.
    This property is only applicable to pinhole cameras.
    Default value: 90

--record-video=[h264|h265|mp4]
    Records the rectified output to a specified video type.
    Default value: N/A

It is possible to apply a basic homography transformation in the form of translations to the input camera. By using LEFT/RIGHT the camera moves left and right, UP/DOWN moves forwards and backwards and U/J moves up and down. The resulting homopgraphy is applied along with the undistortion and is visible in the output image.

Examples

To play a custom video and with a corresponding rig calibration file

./sample_video_rectifier --video=<video file.h264> --rig=<rig.json>

To use a different field of view

./sample_video_rectifier --fovX=90 --fovY=30

Output

The sample creates a window and displays the original video and the rectified version.

sample_rectifier.png
Fisheye video and undistorted version

Additional information

For more details see Rectifier .