Skip to content

Commit

Permalink
TLDR-784 added shift bbox method (#18)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexander Golodkov <[email protected]>
  • Loading branch information
alexander1999-hub and Alexander Golodkov authored Sep 5, 2024
1 parent b38d903 commit be1a0d3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.7
0.3.8
4 changes: 4 additions & 0 deletions dedocutils/data_structures/bbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit be1a0d3

Please sign in to comment.