diff --git a/dedoc/readers/pdf_reader/pdf_image_reader/pdf_image_reader.py b/dedoc/readers/pdf_reader/pdf_image_reader/pdf_image_reader.py index 0206747e..c4b8f454 100644 --- a/dedoc/readers/pdf_reader/pdf_image_reader/pdf_image_reader.py +++ b/dedoc/readers/pdf_reader/pdf_image_reader/pdf_image_reader.py @@ -120,7 +120,7 @@ def _detect_column_count_and_orientation(self, image: np.ndarray, parameters: Pa angle = angle if parameters.document_orientation is None else 0 self.logger.info(f"Final orientation angle = {angle}, is_one_column_document = {is_one_column_document}") - rotated_image, result_angle = self.scew_corrector.preprocess(image, {"rotated_angle": angle}) + rotated_image, result_angle = self.scew_corrector.preprocess(image, {"orientation_angle": angle}) result_angle = result_angle["rotated_angle"] if self.config.get("debug_mode"): diff --git a/tests/unit_tests/test_format_pdf_reader.py b/tests/unit_tests/test_format_pdf_reader.py index 29288a4a..44703b75 100644 --- a/tests/unit_tests/test_format_pdf_reader.py +++ b/tests/unit_tests/test_format_pdf_reader.py @@ -36,7 +36,7 @@ def test_scan_rotator(self) -> None: image = cv2.imread(path) _, orientation = self.orientation_classifier.predict(image) angle_predict = self.orientation_classifier.classes[2 + orientation] - rotated, angle = skew_corrector.preprocess(image, {"rotated_angle": angle_predict}) + rotated, angle = skew_corrector.preprocess(image, {"orientation_angle": angle_predict}) angle = angle["rotated_angle"] self.assertAlmostEqual(angle, angles[i], delta=8) @@ -49,8 +49,9 @@ def test_scan_orientation(self) -> None: path = os.path.join(os.path.dirname(__file__), imgs_path[i]) image = cv2.imread(path) _, angle_predict = self.orientation_classifier.predict(image) - rotated, angle = skew_corrector.preprocess(image, {"rotated_angle": angle_predict}) + rotated, angle = skew_corrector.preprocess(image, {"orientation_angle": angle_predict}) angle = angle["rotated_angle"] + print(angle, angles[i]) self.assertTrue(abs(angle - angles[i]) < max_delta) def test_header_footer_search(self) -> None: