Skip to content

Commit be1a0d3

Browse files
alexander1999-hubAlexander Golodkov
andauthored
TLDR-784 added shift bbox method (#18)
Co-authored-by: Alexander Golodkov <golodkov@ispras.ru>
1 parent b38d903 commit be1a0d3

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Changelog
22
=========
33

4+
v0.3.8 (2024-09-05)
5+
-------------------
6+
* Add `shift` method to `BBox` class
7+
48
v0.3.7 (2024-07-22)
59
-------------------
610
* Move `doctr` dependencies to a separate group

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.3.7
1+
0.3.8

dedocutils/data_structures/bbox.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ def y_bottom_right(self) -> int:
5252
def crop_image_by_box(image: np.ndarray, bbox: "BBox") -> np.ndarray:
5353
return image[bbox.y_top_left:bbox.y_bottom_right, bbox.x_top_left:bbox.x_bottom_right]
5454

55+
def shift(self, shift_x: int, shift_y: int) -> None:
56+
self.x_top_left += shift_x
57+
self.y_top_left += shift_y
58+
5559
def rotate_coordinates(self, angle_rotate: float, image_shape: Tuple[int]) -> None:
5660
xb, yb = self.x_top_left, self.y_top_left
5761
xe, ye = self.x_bottom_right, self.y_bottom_right

0 commit comments

Comments
 (0)