remove unused filter_contours_area_of_image_interiors

pull/19/head
Konstantin Baierer 4 years ago
parent e2ae6dbd44
commit 35838069fc

@ -29,7 +29,6 @@ warnings.filterwarnings("ignore")
from .utils.contour import ( from .utils.contour import (
contours_in_same_horizon, contours_in_same_horizon,
filter_contours_area_of_image_interiors,
filter_contours_area_of_image_tables, filter_contours_area_of_image_tables,
filter_contours_area_of_image, filter_contours_area_of_image,
find_contours_mean_y_diff, find_contours_mean_y_diff,
@ -46,21 +45,11 @@ from .utils.contour import (
from .utils.rotate import ( from .utils.rotate import (
rotate_image, rotate_image,
rotate_max_area,
rotate_max_area_new,
rotatedRectWithMaxArea,
rotation_image_new,
rotation_not_90_func, rotation_not_90_func,
rotation_not_90_func_full_layout, rotation_not_90_func_full_layout
rotyate_image_different,
) )
from .utils.separate_lines import ( 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, textline_contours_postprocessing,
seperate_lines_new2, seperate_lines_new2,
return_deskew_slop, 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))]) 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 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 jv += 1
return found_polygons_early 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): def filter_contours_area_of_image_tables(image, contours, hirarchy, max_area, min_area):
found_polygons_early = list() found_polygons_early = list()

Loading…
Cancel
Save