From 9d30009dceec0357db6499bfaffae8ce97718ee0 Mon Sep 17 00:00:00 2001 From: Matthias Bisping Date: Sun, 6 Feb 2022 14:45:53 +0100 Subject: [PATCH] refactoring --- vidocp/figure_detection.py | 4 ++-- vidocp/utils/__init__.py | 1 + vidocp/{ => utils}/utils.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 vidocp/utils/__init__.py rename vidocp/{ => utils}/utils.py (99%) diff --git a/vidocp/figure_detection.py b/vidocp/figure_detection.py index 2bf77db..2c58968 100644 --- a/vidocp/figure_detection.py +++ b/vidocp/figure_detection.py @@ -7,7 +7,7 @@ from vidocp.utils import ( draw_rectangles, remove_included, remove_primary_text_regions, - __detect_large_coherent_structures, + detect_large_coherent_structures, is_large_enough, has_acceptable_format, ) @@ -22,7 +22,7 @@ def detect_figures(image: np.array): image = image.copy() image = remove_primary_text_regions(image) - cnts = __detect_large_coherent_structures(image) + cnts = detect_large_coherent_structures(image) cnts = filter(is_likely_figure, cnts) rects = map(cv2.boundingRect, cnts) diff --git a/vidocp/utils/__init__.py b/vidocp/utils/__init__.py new file mode 100644 index 0000000..90f60fd --- /dev/null +++ b/vidocp/utils/__init__.py @@ -0,0 +1 @@ +from .utils import * \ No newline at end of file diff --git a/vidocp/utils.py b/vidocp/utils/utils.py similarity index 99% rename from vidocp/utils.py rename to vidocp/utils/utils.py index ff61135..1802fca 100644 --- a/vidocp/utils.py +++ b/vidocp/utils/utils.py @@ -200,7 +200,7 @@ def remove_primary_text_regions(image): return image -def __detect_large_coherent_structures(image: np.array): +def detect_large_coherent_structures(image: np.array): """Detects large coherent structures on an image. References: