Refactoring: Move

This commit is contained in:
Matthias Bisping 2023-02-01 18:38:05 +01:00
parent 42d285e35b
commit 90c367cc32
2 changed files with 23 additions and 24 deletions

View File

@ -6,10 +6,17 @@ import numpy as np
import pytest
from PIL import Image, ImageEnhance
from PIL.Image import Transpose
from funcy import (
juxt,
compose,
identity,
)
from loguru import logger
from cv_analysis.locations import TEST_PAGE_TEXTURES_DIR
from cv_analysis.utils.conversion import normalize_image_format_to_array, normalize_image_format_to_pil
from cv_analysis.utils.image_operations import blur, sharpen, overlay, superimpose
from cv_analysis.utils.rectangle import Rectangle
from synthesis.content_generator import ContentGenerator
from synthesis.partitioner.two_column import TwoColumnPagePartitioner
from synthesis.random import rnd
@ -19,18 +26,6 @@ logger.remove()
logger.add(sys.stderr, level="INFO")
from funcy import (
juxt,
compose,
identity,
)
from cv_analysis.locations import TEST_PAGE_TEXTURES_DIR
from cv_analysis.utils.display import show_image
from cv_analysis.utils.rectangle import Rectangle
@pytest.fixture(
params=[
# "rough_grain",
@ -258,13 +253,4 @@ def page_with_content(
page, boxes = page_with_translucent_content
# page, boxes = page_with_opaque_content
draw_boxes(page, boxes)
return page
def draw_boxes(page: Image, boxes: Iterable[Rectangle]):
from cv_analysis.utils.drawing import draw_rectangles
page = draw_rectangles(page, boxes, filled=False, annotate=True)
show_image(page, backend="pil")
return page, boxes

View File

@ -1,6 +1,19 @@
from typing import Iterable
from PIL.Image import Image
from cv_analysis.utils.display import show_image
from cv_analysis.utils.rectangle import Rectangle
def test_blank_page(page_with_content):
pass
# show_image(blank_page)
page, boxes = page_with_content
draw_boxes(page, boxes)
def draw_boxes(page: Image, boxes: Iterable[Rectangle]):
from cv_analysis.utils.drawing import draw_rectangles
page = draw_rectangles(page, boxes, filled=False, annotate=True)
show_image(page, backend="pil")