dawsonia.table_detect.utils#
Module Contents#
Functions#
Expand a table by subdividing rows according to division_list. |
|
Expand a table by subdividing columns according to division_list. |
|
Sort bounding boxes in reading order (top-to-bottom, then left-to-right). |
Data#
API#
- dawsonia.table_detect.utils.logger#
‘getLogger(…)’
- dawsonia.table_detect.utils.T#
‘TypeVar(…)’
- dawsonia.table_detect.utils.__all__#
(‘all_size_tables_match’, ‘any_size_tables_match’, ‘table_modif_rm_row_col’)
- dawsonia.table_detect.utils.all_size_tables_match(size_tables_detected: Sequence[dawsonia.table_detect.utils.T], size_tables_expected: Sequence[dawsonia.table_detect.utils.T], preproc_cfg: dawsonia.typing.PreprocConfig) Literal[2, 0]#
- dawsonia.table_detect.utils.any_size_tables_match(size_tables_detected: Sequence[dawsonia.table_detect.utils.T], size_tables_expected: Sequence[dawsonia.table_detect.utils.T], preproc_cfg: dawsonia.typing.PreprocConfig) Literal[1, 0]#
- dawsonia.table_detect.utils.remove_row(l_size, list_pos, n_table=0, nb_remove=1)#
- dawsonia.table_detect.utils.remove_col(l_size, list_pos, n_table=0, nb_remove=1)#
- dawsonia.table_detect.utils.table_modif_rm_row_col(l_size, list_pos, idx_tables_size_verify, table_modif)#
- dawsonia.table_detect.utils.apply_row_manipulation(table, n_cols, division_list, original_image, label_tables)#
Expand a table by subdividing rows according to division_list.
Parameters
table : list[tuple] #Flat list of bounding boxes, ordered row-major (left-to-right, top-to-bottom). n_cols : int #Number of columns in the table. division_list : list[list[int]] #Each element is [n_divisions, n_rows].
Returns
new_table : list[tuple] new_l_size : [rows, cols]
- dawsonia.table_detect.utils.apply_col_manipulation(table, n_rows, division_list)#
Expand a table by subdividing columns according to division_list.
Parameters
table : list[tuple] # Flat list of bounding boxes, ordered row-major (left-to-right, top-to-bottom) (x,y,h,w). n_rows : int # Number of rows after contingent row-division division_list : list[[n_divisions, n_cols]]. # Each element is [n_divisions, n_rows]
Returns
new_table : list[tuple] new_l_size : [rows, cols]
- dawsonia.table_detect.utils.sort_boxes_reading_order(boxes, y_tol=5)#
Sort bounding boxes in reading order (top-to-bottom, then left-to-right).
boxes: list of [x0, y0, x1, y1] y_tol: vertical tolerance for grouping boxes into the same row