From 0015f2675b933617673e19dda524db2eb145d5b0 Mon Sep 17 00:00:00 2001 From: Robert Sachunsky Date: Mon, 20 Apr 2026 16:58:16 +0200 Subject: [PATCH] with -slro, also extract and apply page (Border) mask --- src/eynollah/eynollah.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/eynollah/eynollah.py b/src/eynollah/eynollah.py index 966bc83..329aca0 100644 --- a/src/eynollah/eynollah.py +++ b/src/eynollah/eynollah.py @@ -1606,8 +1606,13 @@ class Eynollah: def run_graphics_and_columns_without_layout(self, textline_mask_tot_ea, image): image_page, page_coord, cont_page = self.extract_page(image) - textline_mask_tot_ea = textline_mask_tot_ea[page_coord[0]: page_coord[1], - page_coord[2]: page_coord[3]] + mask_page = np.zeros_like(textline_mask_tot_ea) + mask_page = cv2.fillPoly(mask_page, pts=[cont_page[0]], color=1) + mask_page = mask_page == 0 + + textline_mask_tot_ea[mask_page] = 0 + box = slice(*page_coord[0:2]), slice(*page_coord[2:4]) + textline_mask_tot_ea = textline_mask_tot_ea[box] return page_coord, image_page, textline_mask_tot_ea, cont_page