Skip to content

Commit

Permalink
TLDR-547 changed orientation correction function (#16)
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 Dec 26, 2023
1 parent 9ae8512 commit f5d7401
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
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.6 (2023-12-26)
-------------------
* Fix image orientation correction in `SkewCorrector`

v0.3.5 (2023-10-02)
-------------------
* Delete `Serializable` class
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.5
0.3.6
3 changes: 2 additions & 1 deletion dedocutils/preprocessing/skew_corrector.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ def preprocess(self, image: np.ndarray, parameters: Optional[dict] = None) -> Tu
orientation_angle = parameters.get("orientation_angle", 0)

if orientation_angle:
image = rotate_image(image, orientation_angle)
rotation_nums = orientation_angle // 90
image = np.rot90(image, rotation_nums)

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

0 comments on commit f5d7401

Please sign in to comment.