From e696a068cb5f7ba8425f57ef1790dd19abc80b7e Mon Sep 17 00:00:00 2001 From: Clemens Neudecker <952378+cneud@users.noreply.github.com> Date: Fri, 6 Dec 2019 00:20:34 +0100 Subject: [PATCH 1/2] Fix typos --- qurator/sbb_textline_detector/main.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/qurator/sbb_textline_detector/main.py b/qurator/sbb_textline_detector/main.py index e70e475..249bf1b 100644 --- a/qurator/sbb_textline_detector/main.py +++ b/qurator/sbb_textline_detector/main.py @@ -70,7 +70,7 @@ class textlineerkenner: np.array([point for point in polygon.exterior.coords], dtype=np.uint)) return found_polygons_early - def filter_contours_area_of_image(self, image, contours, hirarchy, max_area, min_area): + def filter_contours_area_of_image(self, image, contours, hierarchy, max_area, min_area): found_polygons_early = list() jv = 0 @@ -81,13 +81,13 @@ class textlineerkenner: polygon = geometry.Polygon([point[0] for point in c]) area = polygon.area if area >= min_area * np.prod(image.shape[:2]) and area <= max_area * np.prod( - image.shape[:2]) and hirarchy[0][jv][3] == -1 : # and hirarchy[0][jv][3]==-1 : + image.shape[:2]) and hierarchy[0][jv][3] == -1 : # and hierarchy[0][jv][3]==-1 : found_polygons_early.append( np.array([ [point] for point in polygon.exterior.coords], dtype=np.uint)) jv += 1 return found_polygons_early - def filter_contours_area_of_image_interiors(self, image, contours, hirarchy, max_area, min_area): + def filter_contours_area_of_image_interiors(self, image, contours, hierarchy, max_area, min_area): found_polygons_early = list() jv = 0 @@ -98,7 +98,7 @@ class textlineerkenner: polygon = geometry.Polygon([point[0] for point in c]) area = polygon.area if area >= min_area * np.prod(image.shape[:2]) and area <= max_area * np.prod(image.shape[:2]) and \ - hirarchy[0][jv][3] != -1: + hierarchy[0][jv][3] != -1: # print(c[0][0][1]) found_polygons_early.append( np.array([point for point in polygon.exterior.coords], dtype=np.uint)) @@ -486,9 +486,9 @@ class textlineerkenner: _, thresh = cv2.threshold(imgray, 0, 255, 0) - contours, hirarchy = cv2.findContours(thresh.copy(), cv2.cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) + contours, hierarchy = cv2.findContours(thresh.copy(), cv2.cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) - main_contours = self.filter_contours_area_of_image(thresh, contours, hirarchy, max_area=1, min_area=0.00001) + main_contours = self.filter_contours_area_of_image(thresh, contours, hierarchy, max_area=1, min_area=0.00001) self.boxes = [] for jj in range(len(main_contours)): From 6c0bfba686c49da2e78a020e0b80c384413ab397 Mon Sep 17 00:00:00 2001 From: Clemens Neudecker <952378+cneud@users.noreply.github.com> Date: Fri, 6 Dec 2019 02:21:04 +0100 Subject: [PATCH 2/2] fix typos --- qurator/sbb_textline_detector/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qurator/sbb_textline_detector/main.py b/qurator/sbb_textline_detector/main.py index 249bf1b..3813bda 100644 --- a/qurator/sbb_textline_detector/main.py +++ b/qurator/sbb_textline_detector/main.py @@ -1378,7 +1378,7 @@ class textlineerkenner: def run(self): - #get image and sclaes, then extract the page of scanned image + #get image and scales, then extract the page of scanned image t1=time.time() self.get_image_and_scales() image_page,page_coord=self.extract_page()