예제 #1
0
def test_as_greyscale_average():
    ones = np.ones([3, 120, 120])
    image = MaskedImage(ones)
    image.pixels[0] *= 0.5
    new_image = image.as_greyscale(mode='average')
    assert (new_image.shape == image.shape)
    assert (new_image.n_channels == 1)
    assert_allclose(new_image.pixels[0], ones[0] * 0.83333333)
예제 #2
0
def test_as_greyscale_luminosity():
    ones = np.ones([3, 120, 120])
    image = MaskedImage(ones)
    image.pixels[0] *= 0.5
    new_image = image.as_greyscale(mode='luminosity')
    assert (new_image.shape == image.shape)
    assert (new_image.n_channels == 1)
    assert_allclose(new_image.pixels[0], ones[0] * 0.850532)
예제 #3
0
def test_as_greyscale_average():
    ones = np.ones([3, 120, 120])
    image = MaskedImage(ones)
    image.pixels[0] *= 0.5
    new_image = image.as_greyscale(mode='average')
    assert (new_image.shape == image.shape)
    assert (new_image.n_channels == 1)
    assert_allclose(new_image.pixels[0], ones[0] * 0.83333333)
예제 #4
0
def test_as_greyscale_luminosity():
    ones = np.ones([3, 120, 120])
    image = MaskedImage(ones)
    image.pixels[0] *= 0.5
    new_image = image.as_greyscale(mode='luminosity')
    assert (new_image.shape == image.shape)
    assert (new_image.n_channels == 1)
    assert_allclose(new_image.pixels[0], ones[0] * 0.850532)
예제 #5
0
파일: image_test.py 프로젝트: ikassi/menpo
def test_as_greyscale_channels():
    image = MaskedImage(np.random.randn(120, 120, 3))
    new_image = image.as_greyscale(mode='channel', channel=0)
    assert (new_image.shape == image.shape)
    assert (new_image.n_channels == 1)
    assert_allclose(new_image.pixels[..., 0], image.pixels[..., 0])
예제 #6
0
파일: image_test.py 프로젝트: ikassi/menpo
def test_as_greyscale_channels_no_index():
    image = MaskedImage(np.ones([120, 120, 3]))
    new_image = image.as_greyscale(mode='channel')
    assert (new_image.shape == image.shape)
    assert (new_image.n_channels == 1)
예제 #7
0
파일: image_test.py 프로젝트: ikassi/menpo
def test_as_greyscale_average():
    image = MaskedImage(np.ones([120, 120, 3]))
    new_image = image.as_greyscale(mode='average')
    assert (new_image.shape == image.shape)
    assert (new_image.n_channels == 1)
예제 #8
0
파일: image_test.py 프로젝트: ikassi/menpo
def test_as_greyscale_luminosity():
    image = MaskedImage(np.ones([120, 120, 3]))
    new_image = image.as_greyscale(mode='luminosity')
    assert (new_image.shape == image.shape)
    assert (new_image.n_channels == 1)
예제 #9
0
def test_as_greyscale_channels():
    image = MaskedImage(np.random.randn(120, 120, 3))
    new_image = image.as_greyscale(mode='channel', channel=0)
    assert (new_image.shape == image.shape)
    assert (new_image.n_channels == 1)
    assert_allclose(new_image.pixels[..., 0], image.pixels[..., 0])
예제 #10
0
def test_as_greyscale_channels_no_index():
    image = MaskedImage(np.ones([120, 120, 3]))
    new_image = image.as_greyscale(mode='channel')
    assert (new_image.shape == image.shape)
    assert (new_image.n_channels == 1)
예제 #11
0
def test_as_greyscale_average():
    image = MaskedImage(np.ones([120, 120, 3]))
    new_image = image.as_greyscale(mode='average')
    assert (new_image.shape == image.shape)
    assert (new_image.n_channels == 1)
예제 #12
0
def test_as_greyscale_luminosity():
    image = MaskedImage(np.ones([120, 120, 3]))
    new_image = image.as_greyscale(mode='luminosity')
    assert (new_image.shape == image.shape)
    assert (new_image.n_channels == 1)