Skip to content

Commit f5d7401

Browse files
alexander1999-hubAlexander Golodkov
and
Alexander Golodkov
authored
TLDR-547 changed orientation correction function (#16)
Co-authored-by: Alexander Golodkov <[email protected]>
1 parent 9ae8512 commit f5d7401

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Changelog
22
=========
33

4+
v0.3.6 (2023-12-26)
5+
-------------------
6+
* Fix image orientation correction in `SkewCorrector`
7+
48
v0.3.5 (2023-10-02)
59
-------------------
610
* Delete `Serializable` class

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.3.5
1+
0.3.6

dedocutils/preprocessing/skew_corrector.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ def preprocess(self, image: np.ndarray, parameters: Optional[dict] = None) -> Tu
2222
orientation_angle = parameters.get("orientation_angle", 0)
2323

2424
if orientation_angle:
25-
image = rotate_image(image, orientation_angle)
25+
rotation_nums = orientation_angle // 90
26+
image = np.rot90(image, rotation_nums)
2627

2728
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
2829
thresh = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY_INV + cv2.THRESH_OTSU)[1]

0 commit comments

Comments
 (0)