pyfisheye.internal.utils package

Submodules

pyfisheye.internal.utils.check_shapes module

pyfisheye.internal.utils.check_shapes.check_shapes(param_names_and_rules)

A decorator for checking the shapes of input elements.

Parameters:

param_names_and_rules (dict[str, str]) – A dictionary containing each parameter to be checked and the corresponding rule. Only objects having ‘shape’ attributes are checked.

Returns:

The decorator.

pyfisheye.internal.utils.common module

pyfisheye.internal.utils.common.build_companion_matrix(coeffs)
Construct a companion matrix for a batch of polynomials. The eigenvalues of each matrix

are the roots of the corresponding polynomial.

Parameters:

coeffs (ndarray) – The coefficients in ascending order, optionally batched for multiple polynomials (of the same degree).

Return type:

ndarray

pyfisheye.internal.utils.common.compute_image_radius(image_width, image_height, distortion_centre)
Compute the maximum L2 norm between a pixel in the image and the distortion centre

(for normalization).

Parameters:
  • image_height (int)

  • image_width (int)

  • distortion_centre (ndarray) – x-y distortion centre.

Return type:

float

Returns:

The image radius being the maximum L2 norm between any point on the image and the distortion centre.

pyfisheye.internal.utils.common.generate_pattern_world_coords(num_rows, num_cols, pattern_tile_size_x, pattern_tile_size_y=None)
Generate a num_rows*num_cols,3 array containing the pattern coordinates in world space

with Z = 0. They are returned in row-major ordering starting at (0, 0, 0).

Parameters:
  • num_rows (int) – The number of rows in the pattern - the number of corners in one column.

  • num_cols (int) – The number of columns in the pattern - the number of corners in one row.

  • pattern_tile_size_x (float) – The width of one tile in the pattern in metres.

  • pattern_tile_size_y (Optional[float]) – The height of one tile in the pattern in metres. Leave as None to default to pattern_tile_size_x.

Return type:

ndarray

Returns:

num_rows*num_cols,3 array of pattern world coordinates with Z=0. (XYZ) ordering.

pyfisheye.internal.utils.common.get_3d_transformation(extr)
Compute the third column of the rotation matrix and return a 3x3 rotation matrix

and 3, translation vector.

Parameters:

extr (ndarray) – The extrinsic parameters as some ndarray with 3,3 in the last two dimensions.

Return type:

tuple[ndarray, ndarray]

Returns:

The rotation matrices and translation vectors for each of the transformations, shape=N*,3,3 and N*,3

pyfisheye.internal.utils.common.get_logger()
Return type:

Logger

Returns:

The logger for the pyfisheye library.

pyfisheye.internal.utils.common.unnormalize_coefficients(coefficients, image_radius)

Convert the coefficients provided, which work on normalized values of rho.

Parameters:
  • coefficients (ndarray) – The 5 coefficients for the omnidirectional camera model.

  • image_radius (float) – The image radius in pixels.

Return type:

ndarray

Returns:

The 5 coefficients, unnormalized.

Module contents