diff --git a/cv_analysis/utils/drawing.py b/cv_analysis/utils/drawing.py index 229105e..f0e8942 100644 --- a/cv_analysis/utils/drawing.py +++ b/cv_analysis/utils/drawing.py @@ -25,7 +25,7 @@ def draw_rectangles(image: Union[np.ndarray, Image.Image], rectangles, color=Non (x + (w // 2) - 12, y + (h // 2) + 9), cv2.FONT_HERSHEY_SIMPLEX, 1, - (0, 255, 0), + (0, 255, 0, 100), 2, ) diff --git a/test/fixtures/page_generation/page.py b/test/fixtures/page_generation/page.py index 2307fcb..5b4073e 100644 --- a/test/fixtures/page_generation/page.py +++ b/test/fixtures/page_generation/page.py @@ -25,6 +25,7 @@ from tabulate import tabulate from cv_analysis.table_parsing import isolate_vertical_and_horizontal_components from cv_analysis.utils import star, rconj, conj from cv_analysis.utils.common import normalize_to_gray_scale +from cv_analysis.utils.drawing import draw_rectangles from cv_analysis.utils.merging import merge_related_rectangles from cv_analysis.utils.postprocessing import remove_overlapping, remove_included from cv_analysis.utils.spacial import area @@ -412,11 +413,11 @@ class ContentGenerator: figure_boxes = lfilter(is_square_like, figure_boxes) text_boxes = merge_related_rectangles(text_boxes) - text_boxes = lmap(generate_recursive_random_table, every_nth(2, text_boxes)) + text_boxes = lmap(generate_random_text_block, every_nth(2, text_boxes)) tables_1, tables_1_captions = zipmap(generate_recursive_random_table_with_caption, every_nth(2, text_boxes[1:])) # TODO: Refactor: Figures should be their own class - plots, plot_captions = zipmap(generate_recursive_random_table_with_caption, every_nth(2, figure_boxes)) + plots, plot_captions = zipmap(generate_random_plot_with_caption, every_nth(2, figure_boxes)) tables_2, tables_2_captions = zipmap( generate_recursive_random_table_with_caption, every_nth(2, figure_boxes[1:]) @@ -1196,7 +1197,7 @@ class PagePartitioner: return boxes def draw_boxes(self, page: Image, boxes: Iterable[Rectangle]): - # page = draw_rectangles(page, boxes, filled=False, annotate=True) + page = draw_rectangles(page, boxes, filled=False, annotate=True) show_image(page) def generate_content_boxes(self, box: Rectangle, depth=0):