@@ -75,18 +75,18 @@ def get_benchmark_cols(
7575 max_x = longest_x_end[-1]
7676
7777 # 根据当前col的起始x坐标,更新col的边界
78- def update_longest_col(col_x_list, cur_v, min_x_, max_x_):
78+ # 2025.2.22 --- 解决最长列可能漏掉最后一列的问题
79+ def update_longest_col(col_x_list, cur_v, min_x_, max_x_, insert_last):
7980 for i, v in enumerate(col_x_list):
8081 if cur_v - col_thresh <= v <= cur_v + col_thresh:
8182 break
82- if cur_v > v:
83- continue
8483 if cur_v < min_x_:
85- # col_x_list.insert(0, cur_v)
84+ col_x_list.insert(0, cur_v)
8685 min_x_ = cur_v
8786 break
8887 if cur_v > max_x_:
89- # col_x_list.append(max_x_)
88+ if insert_last:
89+ col_x_list.append(cur_v)
9090 max_x_ = cur_v
9191 break
9292 if cur_v < v:
@@ -101,10 +101,10 @@ def update_longest_col(col_x_list, cur_v, min_x_, max_x_):
101101 zip(cur_row_start, cur_row_end)
102102 ):
103103 min_x, max_x = update_longest_col(
104- longest_x_start, cur_v_start, min_x, max_x
104+ longest_x_start, cur_v_start, min_x, max_x, True
105105 )
106106 min_x, max_x = update_longest_col(
107- longest_x_start, cur_v_end, min_x, max_x
107+ longest_x_start, cur_v_end, min_x, max_x, False
108108 )
109109
110110 longest_x_start = np.array(longest_x_start)
0 commit comments