Preparation¶
This module provides functions to prepare an image or points for stitching.
-
class
Rectificator(config)[source][source]¶ Bases:
objectClass to rectify images and points.
Remove lens distortion from images and points.
-
rectify_image(image)[source][source]¶ Remove lens distortion from an image.
Parameters: image (ndarray) – Input (distorted) image. Returns: Output (corrected) image with same size and type as image.Return type: ndarray
-
rectify_points(points, size)[source][source]¶ Remove lens distortion from points.
Map points determined from distorted image to its position in an undistorted image.
Parameters: - points (ndarray) – List of (distorted) points (N,2).
- size (tuple) – Size (width, height) of the image, which was used to determine the points.
Returns: List of corrected
points.Return type: ndarray
-
rectify_points_angles(points, angles, size)[source][source]¶ Remove lens distortion from angles.
Map angles determined from distorted image to its angles in an undistorted image.
Parameters: - points (ndarray) – List of (distorted) points (N,2).
- angles (ndarray) – List of Angles in rad (length (N,)).
- size (tuple) – Size (width, height) of the image, which was used to determine the points.
Returns: - rect_points (ndarray) – List of corrected
points - rect_angles (ndarray) – List of corrected
angles
-
-
rotate_image(image, angle)[source][source]¶ Rotate image by given angle.
Parameters: - image (ndarray) – Input image.
- angle (int) – Rotation angle in degree. Positive value means counter-clockwise rotation.
Returns: - rot_image (ndarray) – Rotated
image. - affine_mat (ndarray) – An affine (3,3)–matrix for rotation of image or points.