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, and distoptica.StandardCoordTransformParams before reading the documentation for the current function as it provides essential context to what is discussed below.

Parameters:
standard_coord_transform_paramsdistoptica.StandardCoordTransformParams | None, optional

If standard_coord_transform_params is set to None, 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] and sampling_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. If device_name is a string, then it is the name of the device to be used, e.g. ”cuda” or ”cpu”. If device_name is set to None and a GPU device is available, then a GPU device is to be used. Otherwise, the CPU is used.

least_squares_alg_paramsdistoptica.LeastSquaresAlgParams | None, optional

If least_squares_alg_params is set to None, 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 by distoptica.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 to False, then validations and conversions are performed on the above parameters.

Otherwise, if skip_validation_and_conversion is set to True, 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.

Returns:
distortion_modeldistoptica.DistortionModel

The distortion model generated, according to the above parameters.