def test_collapse_laplacian_pyramid():
    img = load_image(TEST_IMAGE_PATH)
    pyramid = create_laplacian_image_pyramid(img, 5)
    display_image_pyramid(pyramid)
    img_collapsed = collapse_laplacian_pyramid(pyramid)
    display_image(img, "Original")
    display_image(img_collapsed, "Recomposed", wait=True)
    assert (img == img_collapsed).all()
def test_collapse_laplacian_pyramid():
    img = load_image(TEST_IMAGE_PATH)
    pyramid = create_laplacian_image_pyramid(img, 5)
    display_image_pyramid(pyramid)
    img_collapsed = collapse_laplacian_pyramid(pyramid)
    display_image(img, "Original")
    display_image(img_collapsed, "Recomposed", wait=True)
    assert (img == img_collapsed).all()
def test_create_laplacian_image_pyramid():
    pyramid_depth = 3

    img = load_image(TEST_IMAGE_PATH)
    pyramid = create_laplacian_image_pyramid(img, pyramid_depth)
    display_image_pyramid(pyramid)

    means = [np.average(f) for f in pyramid]
    deviations = [np.std(f) for f in pyramid]

    assert len(pyramid) == pyramid_depth
    assert np.std(deviations) > 0.01  # one of the images is just the original sized down photo. there should be significantly more variance in that photo
    assert pyramid[0].shape == img.shape
    assert pyramid[1].shape[0] < pyramid[0].shape[0]
    assert pyramid[2].shape[0] < pyramid[1].shape[0]
def test_create_laplacian_image_pyramid():
    pyramid_depth = 3

    img = load_image(TEST_IMAGE_PATH)
    pyramid = create_laplacian_image_pyramid(img, pyramid_depth)
    display_image_pyramid(pyramid)

    means = [np.average(f) for f in pyramid]
    deviations = [np.std(f) for f in pyramid]

    assert len(pyramid) == pyramid_depth
    assert np.std(
        deviations
    ) > 0.01  # one of the images is just the original sized down photo. there should be significantly more variance in that photo
    assert pyramid[0].shape == img.shape
    assert pyramid[1].shape[0] < pyramid[0].shape[0]
    assert pyramid[2].shape[0] < pyramid[1].shape[0]