mirror of
https://github.com/qurator-spk/eynollah.git
synced 2025-06-08 19:59:56 +02:00
remove unused filter_contours_area_of_image_interiors
This commit is contained in:
parent
e2ae6dbd44
commit
35838069fc
3 changed files with 19 additions and 29 deletions
|
@ -29,7 +29,6 @@ warnings.filterwarnings("ignore")
|
|||
|
||||
from .utils.contour import (
|
||||
contours_in_same_horizon,
|
||||
filter_contours_area_of_image_interiors,
|
||||
filter_contours_area_of_image_tables,
|
||||
filter_contours_area_of_image,
|
||||
find_contours_mean_y_diff,
|
||||
|
@ -46,21 +45,11 @@ from .utils.contour import (
|
|||
|
||||
from .utils.rotate import (
|
||||
rotate_image,
|
||||
rotate_max_area,
|
||||
rotate_max_area_new,
|
||||
rotatedRectWithMaxArea,
|
||||
rotation_image_new,
|
||||
rotation_not_90_func,
|
||||
rotation_not_90_func_full_layout,
|
||||
rotyate_image_different,
|
||||
rotation_not_90_func_full_layout
|
||||
)
|
||||
|
||||
from .utils.separate_lines import (
|
||||
seperate_lines,
|
||||
seperate_lines_new_inside_teils,
|
||||
seperate_lines_new_inside_teils2,
|
||||
seperate_lines_vertical,
|
||||
seperate_lines_vertical_cont,
|
||||
textline_contours_postprocessing,
|
||||
seperate_lines_new2,
|
||||
return_deskew_slop,
|
||||
|
|
|
@ -3070,3 +3070,21 @@ def find_features_of_contours(contours_main):
|
|||
y_max_main = np.array([np.max(contours_main[j][:, 0, 1]) for j in range(len(contours_main))])
|
||||
|
||||
return y_min_main, y_max_main, areas_main
|
||||
|
||||
def filter_contours_area_of_image_interiors(image, contours, hirarchy, max_area, min_area):
|
||||
found_polygons_early = list()
|
||||
|
||||
jv = 0
|
||||
for c in contours:
|
||||
if len(c) < 3: # A polygon cannot have less than 3 points
|
||||
continue
|
||||
|
||||
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:
|
||||
# print(c[0][0][1])
|
||||
found_polygons_early.append(np.array([point for point in polygon.exterior.coords], dtype=np.uint))
|
||||
jv += 1
|
||||
return found_polygons_early
|
||||
|
||||
|
||||
|
|
|
@ -56,23 +56,6 @@ def filter_contours_area_of_image(image, contours, hirarchy, max_area, min_area)
|
|||
jv += 1
|
||||
return found_polygons_early
|
||||
|
||||
def filter_contours_area_of_image_interiors(image, contours, hirarchy, max_area, min_area):
|
||||
found_polygons_early = list()
|
||||
|
||||
jv = 0
|
||||
for c in contours:
|
||||
if len(c) < 3: # A polygon cannot have less than 3 points
|
||||
continue
|
||||
|
||||
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:
|
||||
# print(c[0][0][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_tables(image, contours, hirarchy, max_area, min_area):
|
||||
found_polygons_early = list()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue