Skip to content

Commit

Permalink
round angle to int
Browse files Browse the repository at this point in the history
  • Loading branch information
felixdittrich92 committed Oct 13, 2023
1 parent c1a4fec commit 54dd7b5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions doctr/models/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def get_max_width_length_ratio(contour: np.ndarray) -> float:
return max(w / h, h / w)


def estimate_orientation(img: np.ndarray, n_ct: int = 50, ratio_threshold_for_lines: float = 5) -> float:
def estimate_orientation(img: np.ndarray, n_ct: int = 50, ratio_threshold_for_lines: float = 5) -> int:
"""Estimate the angle of the general document orientation based on the
lines of the document and the assumption that they should be horizontal.
Expand Down Expand Up @@ -72,7 +72,7 @@ def estimate_orientation(img: np.ndarray, n_ct: int = 50, ratio_threshold_for_li
return 0 # in case no angles is found
else:
median = -median_low(angles)
return median if abs(median) != 0 else 0
return round(median) if abs(median) != 0 else 0


def rectify_crops(
Expand Down

0 comments on commit 54dd7b5

Please sign in to comment.