From 9337554348f07c5c42800c8ebe473ef564fbb930 Mon Sep 17 00:00:00 2001 From: Alexander Golodkov Date: Tue, 26 Dec 2023 15:54:00 +0300 Subject: [PATCH] changed rotation function --- dedocutils/preprocessing/skew_corrector.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dedocutils/preprocessing/skew_corrector.py b/dedocutils/preprocessing/skew_corrector.py index 69d4ffb..ddd7dbd 100644 --- a/dedocutils/preprocessing/skew_corrector.py +++ b/dedocutils/preprocessing/skew_corrector.py @@ -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]