mirror of
https://github.com/qurator-spk/eynollah.git
synced 2025-10-15 19:09:58 +02:00
get_text_region_boxes_by_given_contours: simplify
This commit is contained in:
parent
d53f829dfd
commit
2e907875c1
2 changed files with 4 additions and 10 deletions
|
@ -4726,8 +4726,8 @@ class Eynollah:
|
||||||
txt_con_org , conf_contours_textregions = get_textregion_contours_in_org_image_light(
|
txt_con_org , conf_contours_textregions = get_textregion_contours_in_org_image_light(
|
||||||
contours_only_text_parent, self.image, confidence_matrix)
|
contours_only_text_parent, self.image, confidence_matrix)
|
||||||
#print("text region early 4 in %.1fs", time.time() - t0)
|
#print("text region early 4 in %.1fs", time.time() - t0)
|
||||||
boxes_text, _ = get_text_region_boxes_by_given_contours(contours_only_text_parent)
|
boxes_text = get_text_region_boxes_by_given_contours(contours_only_text_parent)
|
||||||
boxes_marginals, _ = get_text_region_boxes_by_given_contours(polygons_of_marginals)
|
boxes_marginals = get_text_region_boxes_by_given_contours(polygons_of_marginals)
|
||||||
#print("text region early 5 in %.1fs", time.time() - t0)
|
#print("text region early 5 in %.1fs", time.time() - t0)
|
||||||
## birdan sora chock chakir
|
## birdan sora chock chakir
|
||||||
if not self.curved_line:
|
if not self.curved_line:
|
||||||
|
|
|
@ -36,14 +36,8 @@ def find_contours_mean_y_diff(contours_main):
|
||||||
return np.mean(np.diff(np.sort(np.array(cy_main))))
|
return np.mean(np.diff(np.sort(np.array(cy_main))))
|
||||||
|
|
||||||
def get_text_region_boxes_by_given_contours(contours):
|
def get_text_region_boxes_by_given_contours(contours):
|
||||||
boxes = []
|
return [cv2.boundingRect(contour)
|
||||||
contours_new = []
|
for contour in contours]
|
||||||
for jj in range(len(contours)):
|
|
||||||
box = cv2.boundingRect(contours[jj])
|
|
||||||
boxes.append(box)
|
|
||||||
contours_new.append(contours[jj])
|
|
||||||
|
|
||||||
return boxes, contours_new
|
|
||||||
|
|
||||||
def filter_contours_area_of_image(image, contours, hierarchy, max_area=1.0, min_area=0.0, dilate=0):
|
def filter_contours_area_of_image(image, contours, hierarchy, max_area=1.0, min_area=0.0, dilate=0):
|
||||||
found_polygons_early = []
|
found_polygons_early = []
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue