Refactoring: Move
This commit is contained in:
parent
42d285e35b
commit
90c367cc32
30
test/fixtures/page_generation/page.py
vendored
30
test/fixtures/page_generation/page.py
vendored
@ -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
|
||||
|
||||
@ -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")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user