예제 #1
0
파일: image_test.py 프로젝트: Amos-zq/menpo
def test_as_pil_image_float32():
    im = MaskedImage(np.ones((120, 120, 1)).astype(np.float32))
    new_im = im.as_PILImage()
    assert_allclose(np.asarray(new_im.getdata()).reshape(im.pixels.shape),
                    (im.pixels * 255).astype(np.uint8))
예제 #2
0
파일: image_test.py 프로젝트: ikassi/menpo
def test_as_pil_image_3channels():
    im = MaskedImage(np.random.randn(120, 120, 3))
    new_im = im.as_PILImage()
    assert_allclose(np.asarray(new_im.getdata()).reshape(im.pixels.shape),
                    (im.pixels * 255).astype(np.uint8))
예제 #3
0
def test_as_pil_image_bad_range():
    im = MaskedImage(np.random.randn(1, 120, 120), copy=False)
    im.as_PILImage()
예제 #4
0
파일: image_test.py 프로젝트: Amos-zq/menpo
def test_as_pil_image_bad_range():
    im = MaskedImage(np.random.randn(120, 120, 1))
    im.as_PILImage()
예제 #5
0
def test_as_pil_image_3channels():
    im = MaskedImage(np.ones((120, 120, 3)))
    new_im = im.as_PILImage()
    assert_allclose(
        np.asarray(new_im.getdata()).reshape(im.pixels.shape),
        (im.pixels * 255).astype(np.uint8))
예제 #6
0
def test_as_pil_image_bad_range():
    im = MaskedImage(np.random.randn(120, 120, 1))
    im.as_PILImage()
예제 #7
0
def test_as_pil_image_bad_range():
    im = MaskedImage(np.random.randn(1, 120, 120), copy=False)
    with raises(ValueError):
        im.as_PILImage()
예제 #8
0
def test_as_pil_image_bad_range():
    im = MaskedImage(np.random.randn(1, 120, 120), copy=False)
    im.as_PILImage()
예제 #9
0
def test_as_pil_image_bad_range():
    im = MaskedImage(np.random.randn(1, 120, 120), copy=False)
    with raises(ValueError):
        im.as_PILImage()