|
|
|
@ -1295,73 +1295,6 @@ def implent_law_head_main_not_parallel(text_regions):
|
|
|
|
|
return text_regions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def return_hor_spliter_by_index(peaks_neg_fin_t, x_min_hor_some, x_max_hor_some):
|
|
|
|
|
|
|
|
|
|
arg_min_hor_sort = np.argsort(x_min_hor_some)
|
|
|
|
|
x_min_hor_some_sort = np.sort(x_min_hor_some)
|
|
|
|
|
x_max_hor_some_sort = x_max_hor_some[arg_min_hor_sort]
|
|
|
|
|
|
|
|
|
|
arg_minmax = np.array(range(len(peaks_neg_fin_t)))
|
|
|
|
|
indexer_lines = []
|
|
|
|
|
indexes_to_delete = []
|
|
|
|
|
indexer_lines_deletions_len = []
|
|
|
|
|
indexr_uniq_ind = []
|
|
|
|
|
for i in range(len(x_min_hor_some_sort)):
|
|
|
|
|
min_h = peaks_neg_fin_t - x_min_hor_some_sort[i]
|
|
|
|
|
max_h = peaks_neg_fin_t - x_max_hor_some_sort[i]
|
|
|
|
|
|
|
|
|
|
min_h[0] = min_h[0] # +20
|
|
|
|
|
max_h[len(max_h) - 1] = max_h[len(max_h) - 1] ##-20
|
|
|
|
|
|
|
|
|
|
min_h_neg = arg_minmax[(min_h < 0) & (np.abs(min_h) < 360)]
|
|
|
|
|
max_h_neg = arg_minmax[(max_h >= 0) & (np.abs(max_h) < 360)]
|
|
|
|
|
|
|
|
|
|
if len(min_h_neg) > 0 and len(max_h_neg) > 0:
|
|
|
|
|
deletions = list(range(min_h_neg[0] + 1, max_h_neg[0]))
|
|
|
|
|
unique_delets_int = []
|
|
|
|
|
# print(deletions,len(deletions),'delii')
|
|
|
|
|
if len(deletions) > 0:
|
|
|
|
|
# print(deletions,len(deletions),'delii2')
|
|
|
|
|
|
|
|
|
|
for j in range(len(deletions)):
|
|
|
|
|
indexes_to_delete.append(deletions[j])
|
|
|
|
|
# print(deletions,indexes_to_delete,'badiii')
|
|
|
|
|
unique_delets = np.unique(indexes_to_delete)
|
|
|
|
|
# print(min_h_neg[0],unique_delets)
|
|
|
|
|
unique_delets_int = unique_delets[unique_delets < min_h_neg[0]]
|
|
|
|
|
|
|
|
|
|
indexer_lines_deletions_len.append(len(deletions))
|
|
|
|
|
indexr_uniq_ind.append([deletions])
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
indexer_lines_deletions_len.append(0)
|
|
|
|
|
indexr_uniq_ind.append(-999)
|
|
|
|
|
|
|
|
|
|
index_line_true = min_h_neg[0] - len(unique_delets_int)
|
|
|
|
|
# print(index_line_true)
|
|
|
|
|
if index_line_true > 0 and min_h_neg[0] >= 2:
|
|
|
|
|
index_line_true = index_line_true
|
|
|
|
|
else:
|
|
|
|
|
index_line_true = min_h_neg[0]
|
|
|
|
|
|
|
|
|
|
indexer_lines.append(index_line_true)
|
|
|
|
|
|
|
|
|
|
if len(unique_delets_int) > 0:
|
|
|
|
|
for dd in range(len(unique_delets_int)):
|
|
|
|
|
indexes_to_delete.append(unique_delets_int[dd])
|
|
|
|
|
else:
|
|
|
|
|
indexer_lines.append(-999)
|
|
|
|
|
indexer_lines_deletions_len.append(-999)
|
|
|
|
|
indexr_uniq_ind.append(-999)
|
|
|
|
|
|
|
|
|
|
peaks_true = []
|
|
|
|
|
for m in range(len(peaks_neg_fin_t)):
|
|
|
|
|
if m in indexes_to_delete:
|
|
|
|
|
pass
|
|
|
|
|
else:
|
|
|
|
|
peaks_true.append(peaks_neg_fin_t[m])
|
|
|
|
|
return indexer_lines, peaks_true, arg_min_hor_sort, indexer_lines_deletions_len, indexr_uniq_ind
|
|
|
|
|
|
|
|
|
|
def combine_hor_lines_and_delete_cross_points_and_get_lines_features_back_new(img_p_in_ver, img_in_hor,num_col_classifier):
|
|
|
|
|
#img_p_in_ver = cv2.erode(img_p_in_ver, self.kernel, iterations=2)
|
|
|
|
|
img_p_in_ver=img_p_in_ver.astype(np.uint8)
|
|
|
|
|