OpenCVModel.apply_distortion

giant.camera_models.opencv_model:

OpenCVModel.apply_distortion(pinhole_locations)[source]

This method applies the distortion model to the specified pinhole (gnomic) locations in the image frame.

In general this function is not used by the user and the higher level project_onto_image() is used which calls this method (along with a few others) instead. In cases were it is desirable to use this method the pinhole locations should be input as a shape (2,) or shape (2, n) array of unitless image plane locations. The output from this function is the unitless distorted image plane locations.

For the OpenCV model, the conversion from gnomic to distorted points is defined as

xI=1+k1r2+k2r4+k3r61+k4r2+k5r4+k6r6xI+[2p1xIyI+p2(r2+2xI2)+s1r2+s2r4p1(r2+2yI2)+2p2xIyI+s3r2+s4r4]

where ΔxI is the distorted gnomic locations, k16 are radial distortion coefficients, p12 are the tangential distortion coefficients, s14 are thin prism distortion coefficients, xI is the unitless gnomic location, and r=xITxI is the radial distance from the optical axis.

Parameters:

pinhole_locations (Sequence | ndarray) – The unitless image plane location of points to be distorted as a shape (2,) or (2, n) array.

Returns:

The unitless distorted locations of the points on the image plane as a shape (2,) or (2, n) array.

Return type:

ndarray