Stitcher¶
This module contains various image stitchers especially designed for the BeesBook Project.
-
class
Stitcher
(config=None, rectify=True)[source][source]¶ Bases:
object
Class to create a ‘panorama’ from two images.
Warning
This class is more like an abstract class. This
Stitcher
can not be used to estimate the required parameters for stitching. But if you already estimated the parameters with an otherStitcher
you could use this on for stitching.See also
-
load_parameters
(homo_left=None, homo_right=None, size_left=None, size_right=None)[source][source]¶ Load needed parameters for stitching points, angles and images.
This function becomes handy if you calculate the parameters in an earlier stitching process and did not want to calculate the parameters again and just want to map points, angles or images which were made under the same camera setup as the earlier stitching process.Parameters: - homo_left (ndarray) – homography (3,3) for data from the left side to form a panorama.
- homo_right (ndarray) – homography (3,3) for data from the right side to form a panorama.
- size_left (tuple) – Size of the left image, which was used to calculate homography.
- size_right (tuple) – Size of the right image, which was used to calculate homography.
-
get_parameters
()[source][source]¶ Return the estimated or loaded parameters of the stitcher needed for later stitching.
With this function you could save the stitching parameters and load them later for further stitching of points and angles (see
set_parameters
).Use this function if you estimated the transform and did not want to estimate the parameters again.
-
estimate_transform
(image_left, image_right, angle_left=0, angle_right=0)[source][source]¶ Estimate transformation/homography of the left and right images/data to form a panorama.
Return the transformation matrix for the left and right image.
Parameters: Warning
This must be overridden by a sublcass to customize stitching.
-
compose_panorama
(image_left, image_right)[source][source]¶ Try to compose the given images into the final panorama.
This happens under the assumption that the image transformations were estimated or loaded before.
Parameters: - image_left (ndarray) – Input left image.
- image_right (ndarray) – Input right image.
Returns: panorama (stitched image)
Return type: ndarray
-
map_left_points
(points)[source][source]¶ Map points from the left image to the panorama.
This happens under the assumption that the image transformations were estimated or loaded before.
Parameters: points (ndarray(float)) – List of points from left image (N,2). Returns: points
mapped to panorama (N,2)Return type: ndarray
-
map_left_points_angles
(points, angles)[source][source]¶ Map points and angles from the left image to the panorama.
This happens under the assumption that the image transformations were estimated or loaded before.
Parameters: - points (ndarray(float)) – List of points from left image (N,2).
- angles (ndarray) – Angles in rad (length (N,)).
Returns: - points_mapped (ndarray) –
points
mapped to panorama (N,2) - angles_mapped (ndarray) –
angles
mapped to panorama (N,)
-
map_right_points
(points)[source][source]¶ Map points from the right image to the panorama.
This happens under the assumption that the image transformations were estimated or loaded before.
Parameters: points (ndarray(float)) – List of points from right image (N,2). Returns: points
mapped to panorama (N,2)Return type: ndarray
-
map_right_points_angles
(points, angles)[source][source]¶ Map points and angles from the right image to the panorama.
This happens under the assumption that the image transformations were estimated or loaded before.
Parameters: - points (ndarray(float)) – List of points from right image (N,2).
- angles (ndarray) – Angles in rad (length (N,)).
Returns: - points_mapped (ndarray) –
points
mapped to panorama (N,2) - angles_mapped (ndarray) –
angles
mapped to panorama (N,)
-
-
class
FeatureBasedStitcher
(config=None, rectify=True)[source][source]¶ Bases:
bb_stitcher.stitcher.Stitcher
Class to create a feature based stitcher.
-
class
RectangleStitcher
(config=None, rectify=True)[source][source]¶ Bases:
bb_stitcher.stitcher.Stitcher
Class to create a rectangle stitcher.
The
RectangleStitcher
maps selected points to an abstracted rectangle.