PinholeModel.undistort_image¶
giant.camera_models.pinhole_model
:
- PinholeModel.undistort_image(image, return_shape='same')¶
This method takes in an entire image and warps it to remove the distortion specified by the current model.
The image should be input as a (n, m) array of gray-scale illumination values (DN values).
The warping is formed by
generating a grid of subscripts for each cell of the image (these are the distorted pixel locations)
computing the corresponding gnomic location of these points using the
undistort_pixels()
methodre-sampling the undistorted image data to form a new image with distortion removed
In general you should avoid using this function because it is much more computationally expensive than working with the nominal distorted image and then undistorting specific points for OpNav measurements.
If
return_shape
is'same'
then the returned image is the same size as the input image (and the undistorted image is either cropped or padded to fit this shape). Ifreturn_shape
is'full'
then the returned image is the size of what the detector would need to be to capture the image from the camera if it was a pinhole model.- Parameters:
image (ndarray) – The image to have the distortion removed from as a (n, m) array of gray-scale illumination values
return_shape (ReturnShape | str) – Specify whether to return the full undistorted image or the undistorted image set to the same size as the original
- Returns:
The undistorted image as an array of shape (n, m) illumination values
- Return type:
ndarray
Note
The re-sampled image has NaN specified for anywhere that would be considered extrapolation in the re-sampling process. This means that the undistorted image will generally look somewhat weird around the edges.