Exemple #1
0
def test_sharpness_with_PIL(factor):
    np.random.seed(0)
    image = np.random.randint(low=0, high=255, size=(10, 5, 5, 3), dtype=np.uint8)
    sharpened = np.stack(
        [ImageEnhance.Sharpness(Image.fromarray(i)).enhance(factor) for i in image]
    )
    np.testing.assert_allclose(
        color_ops.sharpness(tf.constant(image), factor).numpy(), sharpened, atol=1
    )
Exemple #2
0
def test_sharpness_dtype_shape(dtype, shape):
    image = np.ones(shape=shape, dtype=dtype)
    sharp = color_ops.sharpness(tf.constant(image), 0).numpy()
    np.testing.assert_equal(sharp, image)
    assert sharp.dtype == image.dtype