|
|
|
@ -2715,16 +2715,16 @@ class Eynollah():
|
|
|
|
|
"""
|
|
|
|
|
self.logger.debug("enter run")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
t0_tot = time.time()
|
|
|
|
|
|
|
|
|
|
if not self.batch_processing_mode:
|
|
|
|
|
# FIXME: why?
|
|
|
|
|
self.ls_imgs = [1]
|
|
|
|
|
|
|
|
|
|
for img_name in self.ls_imgs:
|
|
|
|
|
t0 = time.time()
|
|
|
|
|
if self.batch_processing_mode:
|
|
|
|
|
self.reset_file_name_dir(join(self.dirs.dir_in,img_name))
|
|
|
|
|
self.reset_file_name_dir(join(self.dirs.dir_in, img_name))
|
|
|
|
|
|
|
|
|
|
img_res, is_image_enhanced, num_col_classifier, num_column_is_classified = self.run_enhancement(self.light_version)
|
|
|
|
|
self.logger.info("Enhancing took %.1fs ", time.time() - t0)
|
|
|
|
@ -2848,10 +2848,6 @@ class Eynollah():
|
|
|
|
|
p[1] = p[1] - y_diff[0]
|
|
|
|
|
dists = [math.sqrt((p[0] - cx_bigest_d[j]) ** 2 + (p[1] - cy_biggest_d[j]) ** 2) for j in range(len(cx_bigest_d))]
|
|
|
|
|
contours_only_text_parent_d_ordered.append(contours_only_text_parent_d[np.argmin(dists)])
|
|
|
|
|
# img2=np.zeros((text_only.shape[0],text_only.shape[1],3))
|
|
|
|
|
# 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 = []
|
|
|
|
@ -2879,9 +2875,6 @@ class Eynollah():
|
|
|
|
|
|
|
|
|
|
cx_bigest_big, cy_biggest_big, _, _, _, _, _ = find_new_features_of_contours([contours_biggest])
|
|
|
|
|
cx_bigest, cy_biggest, _, _, _, _, _ = find_new_features_of_contours(contours_only_text_parent)
|
|
|
|
|
#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
|
|
|
|
|
if self.light_version:
|
|
|
|
@ -2962,13 +2955,6 @@ class Eynollah():
|
|
|
|
|
else:
|
|
|
|
|
boxes_d, peaks_neg_tot_tables_d = return_boxes_of_images_by_order_of_reading_new(splitter_y_new_d, regions_without_separators_d, matrix_of_lines_ch_d, num_col_classifier, erosion_hurts, self.tables, self.right2left)
|
|
|
|
|
|
|
|
|
|
#print(boxes_d,'boxes_d')
|
|
|
|
|
#img_once = np.zeros((textline_mask_tot_d.shape[0],textline_mask_tot_d.shape[1]))
|
|
|
|
|
#for box_i in boxes_d:
|
|
|
|
|
#img_once[int(box_i[2]):int(box_i[3]),int(box_i[0]):int(box_i[1]) ] =1
|
|
|
|
|
#plt.imshow(img_once)
|
|
|
|
|
#plt.show()
|
|
|
|
|
#print(np.unique(img_once),'img_once')
|
|
|
|
|
if self.plotter:
|
|
|
|
|
self.plotter.write_images_into_directory(polygons_of_images, image_page)
|
|
|
|
|
t_order = time.time()
|
|
|
|
|