diff --git a/test/fixtures/page_generation/page.py b/test/fixtures/page_generation/page.py index 2ffd1f4..a3fb01d 100644 --- a/test/fixtures/page_generation/page.py +++ b/test/fixtures/page_generation/page.py @@ -27,7 +27,7 @@ def color_name(request): return request.param -@pytest.fixture(params=["smooth", "coarse"]) +@pytest.fixture(params=["smooth", "coarse", "neutral"]) def texture_name(request): return request.param @@ -44,16 +44,19 @@ def color(color_name): @pytest.fixture -def texture_fn(texture_name): +def texture_fn(texture_name, size): if texture_name == "smooth": - return lambda image: cv.blur(image, (5, 5)) + return lambda image: cv.blur(image, np.array(size) // 100) elif texture_name == "coarse": return lambda image: cv.filter2D(image, -1, np.array([[-1, -1, -1], [-1, 9, -1], [-1, -1, -1]])) + elif texture_name == "neutral": + return lambda image: image @pytest.fixture def texture(texture_fn, size, color): noise = np.random.rand(*size) * 255 + noise = texture_fn(noise) noise = color_shift_noise(noise, color) noise = zero_out_below_threshold(noise, 0.1) return Image.fromarray(noise.astype("uint8")) @@ -107,7 +110,7 @@ def zero_out_below_threshold(texture, threshold): texture[:, :, 0] = (texture[:, :, 0] / texture[:, :, 0].max()) * 255 texture[:, :, 1] = (texture[:, :, 1] / texture[:, :, 1].max()) * 255 texture[:, :, 2] = (texture[:, :, 2] / texture[:, :, 2].max()) * 255 - texture[:, :, 3] = 50 + texture[:, :, 3] = 25 threshold_mask = texture[:, :, 0] >= threshold texture[~threshold_mask] = [0, 0, 0, 0] diff --git a/test/page_generation_test.py b/test/page_generation_test.py index 7790ed6..e768ade 100644 --- a/test/page_generation_test.py +++ b/test/page_generation_test.py @@ -3,4 +3,4 @@ from cv_analysis.utils.display import show_image def test_blank_page(blank_page): pass - # show_image(blank_page) + show_image(blank_page)