2.1. distoptica.generate_standard_distortion_model
- generate_standard_distortion_model(standard_coord_transform_params=None, sampling_grid_dims_in_pixels=(512, 512), device_name=None, least_squares_alg_params=None, skip_validation_and_conversion=False)[source]
Generate a “standard” optical distortion model.
Users are encouraged to read the summary documentation of the classes
distoptica.DistortionModel
,distoptica.CoordTransformParams
, anddistoptica.StandardCoordTransformParams
before reading the documentation for the current function as it provides essential context to what is discussed below.- Parameters:
- standard_coord_transform_params
distoptica.StandardCoordTransformParams
| None, optional If
standard_coord_transform_params
is set toNone
, then the coordinate transformation \(\left(T_{⌑;x}\left(u_{x},u_{y}\right), T_{⌑;y}\left(u_{x},u_{y}\right)\right)\) to be used is the identity transformation. Otherwise,standard_coord_transform_params
specifies the parameters of the standard coordinate transformation to be used.- sampling_grid_dims_in_pixelsarray_like (int, shape=(2,)), optional
The dimensions of the sampling grid, in units of pixels:
sampling_grid_dims_in_pixels[0]
andsampling_grid_dims_in_pixels[1]
are the number of pixels in the sampling grid from left to right and top to bottom respectively.- device_namestr | None, optional
This parameter specifies the device to be used to perform computationally intensive calls to PyTorch functions and where to store attributes of the type
torch.Tensor
. Ifdevice_name
is a string, then it is the name of the device to be used, e.g.”cuda”
or”cpu”
. Ifdevice_name
is set toNone
and a GPU device is available, then a GPU device is to be used. Otherwise, the CPU is used.- least_squares_alg_params
distoptica.LeastSquaresAlgParams
| None, optional If
least_squares_alg_params
is set toNone
, then the parameters of the least-squares algorithm to be used to calculate the functions \(\left(T_{\square;x}\left(q_{x},q_{y}\right), T_{\square;y}\left(q_{x},q_{y}\right)\right)\), i.e. the functions defined by Eqs. (2.3.1) and (2.3.2), are those specified bydistoptica.LeastSquaresAlgParams()
. Otherwise,least_squares_alg_params
specifies the parameters of the least-squares algorithm to be used.- skip_validation_and_conversionbool, optional
If
skip_validation_and_conversion
is set toFalse
, then validations and conversions are performed on the above parameters.Otherwise, if
skip_validation_and_conversion
is set toTrue
, no validations and conversions are performed on the above parameters. This option is desired primarily when the user wants to avoid potentially expensive validation and/or conversion operations.
- standard_coord_transform_params
- Returns:
- distortion_model
distoptica.DistortionModel
The distortion model generated, according to the above parameters.
- distortion_model