def test_normalize_std_channels(): pixels = np.arange(27, dtype=np.float).reshape([3, 3, 3]) image = Image(pixels, copy=False) new_image = normalize_std(image, mode='per_channel') assert_allclose(np.std(new_image.pixels[0]), 1.) assert_allclose(np.std(new_image.pixels[1]), 1.) assert_allclose(np.std(new_image.pixels[2]), 1.)
def test_normalize_std_all(): pixels = np.arange(27, dtype=np.float).reshape([3, 3, 3]) image = Image(pixels, copy=False) new_image = normalize_std(image, mode='all') assert_allclose(np.std(new_image.pixels), 1.)