augment.undistort

Description

Removes distortion from a wide-angle camera image.

class Node(config=None, **kwargs)[source]

Undistorts an image by removing radial and tangential distortion. This may help to improve the performance of certain models.

Before using this node for the first time, please follow the tutorial in dabble.camera_calibration to calculate the camera coefficients of the camera you are using, and ensure that the file_path that the coefficients are stored in is the same as the one specified in the configs.

The images below show an example of an image before and after undistortion. Note that after undistortion, the shape of the image will change and the FOV will be reduced slightly.

../_images/undistort.png

Before undistortion (left) and after undistortion (right)

Inputs

img (numpy.ndarray): A NumPy array of shape \((height, width, channels)\) containing the image data in BGR format.

Outputs

img (numpy.ndarray): A NumPy array of shape \((height, width, channels)\) containing the image data in BGR format.

Configs

file_path (str) – default = “PeekingDuck/data/camera_calibration_coeffs.yml”.
Path of the YML file containing calculated camera coefficients.