From 56e73bf72f412e5fb235a1c525834130a8932880 Mon Sep 17 00:00:00 2001 From: Robert Sachunsky Date: Fri, 28 Nov 2025 18:27:58 +0100 Subject: [PATCH] deskewing: add a 2nd stage for precision after selecting the optimum angle on the original search range, narrow down around in the vicinity with half the range (adding computational costs, but gaining precision) --- src/eynollah/utils/separate_lines.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/eynollah/utils/separate_lines.py b/src/eynollah/utils/separate_lines.py index 22ef00d..7e415b5 100644 --- a/src/eynollah/utils/separate_lines.py +++ b/src/eynollah/utils/separate_lines.py @@ -1564,6 +1564,9 @@ def return_deskew_slop(img_patch_org, sigma_des,n_tot_angles=100, angle2, var2 = get_smallest_skew(img_resized, sigma_des, angles2, map=map, logger=logger, plotter=plotter) if var2 > var: angle = angle2 + # precision stage: + angles = np.linspace(angle - 2.5, angle + 2.5, n_tot_angles // 2) + angle, _ = get_smallest_skew(img_resized, sigma_des, angles, map=map, logger=logger, plotter=plotter) return angle def get_smallest_skew(img, sigma_des, angles, logger=None, plotter=None, map=map):