def test_random_contrast_float(alpha, expected): img = np.ones((100, 100, 3), dtype=np.float32) * 0.4 expected = np.ones((100, 100, 3), dtype=np.float32) * expected img = F.random_contrast(img, alpha) assert img.dtype == np.dtype('float32') assert_array_almost_equal_nulp(img, expected)
def test_random_contrast(alpha, expected): img = np.ones((100, 100, 3), dtype=np.uint8) * 127 img = F.random_contrast(img, alpha) assert img.dtype == np.dtype('uint8') assert (img == expected).all()
def test_random_contrast(alpha, expected): img = np.ones((100, 100, 3), dtype=np.uint8) * 127 img = F.random_contrast(img, alpha) assert img.dtype == np.dtype('uint8') assert (img == expected).all()