polygon_function
data.transform.polygon_function
calculate_transform_matrix
calculate_transform_matrix(width: int, height: int, offset_top_left: OffsetType, offset_top_right: OffsetType, offset_bottom_right: OffsetType, offset_bottom_left: OffsetType) -> ndarray
Calculates the perspective transformation matrix using the given width, height, and corner points of a rectangle.
Parameters:
-
width(int) –Width of the original image.
-
height(int) –Height of the original image.
-
offset_top_left(OffsetType) – -
offset_bottom_right(OffsetType) – -
offset_top_right(OffsetType) –The offset ratio of the top-left corner point.
-
offset_bottom_left(OffsetType) –The offset ratio of the bottom-left corner point.
Returns:
-
ndarray–np.ndarray: The 4x3 perspective transform matrix.
Source code in SaigeToolkit/data/transform/augmentation/augment_function.py
check_value
Source code in SaigeToolkit/data/transform/function_util.py
vertical_flip
vertical_flip(polygons: PolygonType, image_size: Tuple[int]) -> PolygonType
horizontal_flip
horizontal_flip(polygons: PolygonType, image_size: Tuple[int]) -> PolygonType
rotate
rotate(polygons: PolygonType, angle: float, image_size: Tuple[int], target_size: Optional[Tuple[int]] = None) -> PolygonType
Source code in SaigeToolkit/data/transform/polygon_function.py
rotate90
rotate90(polygons: PolygonType, factor: int, image_size: Tuple[int]) -> PolygonType
Source code in SaigeToolkit/data/transform/polygon_function.py
ratio_jitter
ratio_jitter(polygons: PolygonType, image_size: Tuple[int], proportion_left: float, proportion_right: float, proportion_top: float, proportion_bottom: float) -> PolygonType
Source code in SaigeToolkit/data/transform/polygon_function.py
zoom
zoom(polygons: PolygonType, image_size: Tuple[int], ratio: float, h_start: float, w_start: float) -> PolygonType
Source code in SaigeToolkit/data/transform/polygon_function.py
random_resized_crop_and_pad
random_resized_crop_and_pad(polygons: PolygonType, image_size: Tuple[int], scale: float, aspect_ratio: float, h_start: float, w_start: float, h_target: Optional[int] = None, w_target: Optional[int] = None, **params) -> PolygonType
Source code in SaigeToolkit/data/transform/polygon_function.py
perspective_transform
perspective_transform(polygons: PolygonType, image_size: Tuple[int], offset_top_left: OffsetType, offset_top_right: OffsetType, offset_bottom_right: OffsetType, offset_bottom_left: OffsetType) -> PolygonType
Source code in SaigeToolkit/data/transform/polygon_function.py
resize_polygon
resize_polygon(polygons: PolygonType, image_size: Tuple[int], tw: int, th: int) -> PolygonType
Resize polygon from (w, h) to (tw, th)
Source code in SaigeToolkit/data/transform/polygon_function.py
translate_polygon
translate_polygon(polygons: PolygonType, offset: Tuple[int]) -> PolygonType
Translate polyfon from [(x1, y1), ... ] to [(x1 - x_offset), (y1 - y_offset), ...]