diff --git a/CHANGELOG.md b/CHANGELOG.md index 777ba3f..cdd0f83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ Changelog ========= +v0.3.8 (2024-09-05) +------------------- +* Add `shift` method to `BBox` class + v0.3.7 (2024-07-22) ------------------- * Move `doctr` dependencies to a separate group diff --git a/VERSION b/VERSION index ce4f5af..4209dba 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.3.7 \ No newline at end of file +0.3.8 \ No newline at end of file diff --git a/dedocutils/data_structures/bbox.py b/dedocutils/data_structures/bbox.py index 78dcf8b..bf14ac7 100644 --- a/dedocutils/data_structures/bbox.py +++ b/dedocutils/data_structures/bbox.py @@ -52,6 +52,10 @@ def y_bottom_right(self) -> int: def crop_image_by_box(image: np.ndarray, bbox: "BBox") -> np.ndarray: return image[bbox.y_top_left:bbox.y_bottom_right, bbox.x_top_left:bbox.x_bottom_right] + def shift(self, shift_x: int, shift_y: int) -> None: + self.x_top_left += shift_x + self.y_top_left += shift_y + def rotate_coordinates(self, angle_rotate: float, image_shape: Tuple[int]) -> None: xb, yb = self.x_top_left, self.y_top_left xe, ye = self.x_bottom_right, self.y_bottom_right