|
|
|
@ -1869,6 +1869,8 @@ class Eynollah:
|
|
|
|
|
if np.abs(slope_deskew) >= SLOPE_THRESHOLD:
|
|
|
|
|
contours_only_text, hir_on_text = return_contours_of_image(text_only)
|
|
|
|
|
contours_only_text_parent = return_parent_contours(contours_only_text, hir_on_text)
|
|
|
|
|
|
|
|
|
|
if len(contours_only_text_parent) > 0:
|
|
|
|
|
areas_cnt_text = np.array([cv2.contourArea(contours_only_text_parent[j]) for j in range(len(contours_only_text_parent))])
|
|
|
|
|
areas_cnt_text = areas_cnt_text / float(text_only.shape[0] * text_only.shape[1])
|
|
|
|
|
self.logger.info('areas_cnt_text %s', areas_cnt_text)
|
|
|
|
@ -1932,10 +1934,15 @@ class Eynollah:
|
|
|
|
|
# img2=cv2.fillPoly(img2,pts=[contours_only_text_parent_d[np.argmin(dists)]] ,color=(1,1,1))
|
|
|
|
|
# plt.imshow(img2[:,:,0])
|
|
|
|
|
# plt.show()
|
|
|
|
|
else:
|
|
|
|
|
contours_only_text_parent_d_ordered = []
|
|
|
|
|
contours_only_text_parent_d = []
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
contours_only_text, hir_on_text = return_contours_of_image(text_only)
|
|
|
|
|
contours_only_text_parent = return_parent_contours(contours_only_text, hir_on_text)
|
|
|
|
|
|
|
|
|
|
if len(contours_only_text_parent) > 0:
|
|
|
|
|
areas_cnt_text = np.array([cv2.contourArea(contours_only_text_parent[j]) for j in range(len(contours_only_text_parent))])
|
|
|
|
|
areas_cnt_text = areas_cnt_text / float(text_only.shape[0] * text_only.shape[1])
|
|
|
|
|
|
|
|
|
@ -1952,6 +1959,8 @@ class Eynollah:
|
|
|
|
|
self.logger.debug('areas_cnt_text_parent %s', areas_cnt_text_parent)
|
|
|
|
|
# self.logger.debug('areas_cnt_text_parent_d %s', areas_cnt_text_parent_d)
|
|
|
|
|
# self.logger.debug('len(contours_only_text_parent) %s', len(contours_only_text_parent_d))
|
|
|
|
|
else:
|
|
|
|
|
pass
|
|
|
|
|
txt_con_org = get_textregion_contours_in_org_image(contours_only_text_parent, self.image, slope_first)
|
|
|
|
|
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)
|
|
|
|
|