Beispiel #1
0
def test_squared_even_patches_landmarks():
    image = mio.import_builtin_asset('breakingbad.jpg')
    patch_shape = (16, 16)
    patches = image.extract_patches_around_landmarks('PTS',
                                                     patch_shape=patch_shape,
                                                     as_single_array=False)
    assert_equals(len(patches), 68)
Beispiel #2
0
def test_squared_even_patches():
    image = mio.import_builtin_asset('breakingbad.jpg')
    patch_shape = (16, 16)
    patches = extract_local_patches_fast(
        image, image.landmarks['PTS'].lms, patch_shape)
    print patches.shape
    assert(patches.shape == (68,) + patch_shape + (3,))
Beispiel #3
0
def test_import_asset_bunny():
    mesh = mio.import_builtin_asset('bunny.obj')
    assert(isinstance(mesh, TriMesh))
    assert(isinstance(mesh.points, np.ndarray))
    assert(mesh.points.shape[1] == 3)
    assert(isinstance(mesh.trilist, np.ndarray))
    assert(mesh.trilist.shape[1] == 3)
Beispiel #4
0
def test_lenna_import():
    img = mio.import_builtin_asset('lenna.png')
    assert (img.shape == (512, 512))
    assert (img.n_channels == 3)
    assert (img.landmarks.n_groups == 2)
    assert (img.landmarks['LJSON'].n_points == 68)
    assert (img.landmarks['pupils'].n_points == 2)
Beispiel #5
0
def test_squared_even_patches():
    image = mio.import_builtin_asset('breakingbad.jpg')
    patch_shape = (16, 16)
    patches = extract_local_patches_fast(image, image.landmarks['PTS'].lms,
                                         patch_shape)
    print(patches.shape)
    assert (patches.shape == (68, ) + patch_shape + (3, ))
def test_squared_even_patches_single_array():
    image = mio.import_builtin_asset('breakingbad.jpg')
    patch_shape = (16, 16)
    patches = image.extract_patches(image.landmarks['PTS'].lms,
                                    as_single_array=True,
                                    patch_shape=patch_shape)
    assert_equals(patches.shape, ((68, 1, 3) + patch_shape))
Beispiel #7
0
def test_squared_even_patches_single_array():
    image = mio.import_builtin_asset('breakingbad.jpg')
    patch_shape = (16, 16)
    patches = image.extract_patches(image.landmarks['PTS'],
                                    as_single_array=True,
                                    patch_shape=patch_shape)
    assert_equals(patches.shape, ((68, 1, 3) + patch_shape))
Beispiel #8
0
def test_sampling_out_of_bounds(patch_shape, expected_valid):
    image = mio.import_builtin_asset("breakingbad.jpg")
    sample_offsets = np.array([[0, 0], [1, 0]])
    cval = -100
    points = np.array([[0, 0.0]])
    sliced_patches = extract_patches_by_sampling(image.pixels,
                                                 points,
                                                 patch_shape,
                                                 sample_offsets,
                                                 cval=cval)

    offset = (patch_shape[0] // 2, patch_shape[1] // 2)
    assert_allclose(
        sliced_patches[0, 0, :, offset[0]:, offset[1]:],
        image.pixels[:, :expected_valid[0], :expected_valid[1]],
        rtol=1e-4,
    )
    assert_allclose(sliced_patches[0, 0, :, :offset[0], :offset[1]], -100)

    # Offset in row direction by 1
    assert_allclose(
        sliced_patches[0, 1, :, offset[0]:, offset[1]:],
        image.pixels[:, 1:expected_valid[0] + 1, :expected_valid[1]],
        rtol=1e-4,
    )
    assert_allclose(sliced_patches[0, 1, :, :offset[0], :offset[1]], -100)
Beispiel #9
0
def test_import_asset_bunny():
    mesh = mio.import_builtin_asset('bunny.obj')
    assert(isinstance(mesh, TriMesh))
    assert(isinstance(mesh.points, np.ndarray))
    assert(mesh.points.shape[1] == 3)
    assert(isinstance(mesh.trilist, np.ndarray))
    assert(mesh.trilist.shape[1] == 3)
def test_squared_even_patches_sample_offsets():
    image = mio.import_builtin_asset('breakingbad.jpg')
    image = labeller(image, 'PTS', ibug_face_68)
    sample_offsets = PointCloud([[0, 0], [1, 0]])
    patches = image.extract_patches(image.landmarks['PTS'].lms,
                                    sample_offsets=sample_offsets)
    assert_equals(len(patches), 136)
Beispiel #11
0
def test_double_type():
    image = mio.import_builtin_asset('breakingbad.jpg')
    patch_shape = (16, 16)
    patches = image.extract_patches(image.landmarks['PTS'].lms,
                                    patch_shape=patch_shape,
                                    as_single_array=False)
    assert(patches[0].pixels.dtype == np.float64)
Beispiel #12
0
def test_warp_multi():
    rgb_image = mio.import_builtin_asset('takeo.ppm')
    target_transform = Affine.init_identity(2).from_vector(initial_params)
    warped_im = rgb_image.warp_to_mask(template_mask, target_transform)

    assert(warped_im.shape == rgb_template.shape)
    assert_allclose(warped_im.pixels, rgb_template.pixels)
def test_nonsquared_even_patches():
    image = mio.import_builtin_asset('breakingbad.jpg')
    patch_shape = (16, 18)
    patches = image.extract_patches(image.landmarks['PTS'],
                                    patch_shape=patch_shape,
                                    as_single_array=False)
    assert len(patches) == 68
def test_squared_even_patches_sample_offsets():
    image = mio.import_builtin_asset("breakingbad.jpg")
    sample_offsets = np.array([[0, 0], [1, 0]])
    patches = image.extract_patches(
        image.landmarks["PTS"], sample_offsets=sample_offsets, as_single_array=False
    )
    assert len(patches) == 136
def test_nonsquared_even_patches():
    image = mio.import_builtin_asset("breakingbad.jpg")
    patch_shape = (16, 18)
    patches = image.extract_patches(
        image.landmarks["PTS"], patch_shape=patch_shape, as_single_array=False
    )
    assert len(patches) == 68
Beispiel #16
0
def test_nonsquared_odd_patches():
    image = mio.import_builtin_asset('breakingbad.jpg')
    patch_shape = (15, 17)
    patches = image.extract_patches(image.landmarks['PTS'],
                                    patch_shape=patch_shape,
                                    as_single_array=False)
    assert_equals(len(patches), 68)
Beispiel #17
0
def test_nonsquared_odd_patches():
    image = mio.import_builtin_asset('breakingbad.jpg')
    patch_shape = (15, 17)
    patches = image.extract_patches(image.landmarks['PTS'].lms,
                                    patch_shape=patch_shape,
                                    as_single_array=False)
    assert_equals(len(patches), 68)
Beispiel #18
0
def test_squared_even_patches_sample_offsets():
    image = mio.import_builtin_asset('breakingbad.jpg')
    image = labeller(image, 'PTS', ibug_face_68)
    sample_offsets = np.array([[0, 0], [1, 0]])
    patches = image.extract_patches(image.landmarks['PTS'].lms,
                                    sample_offsets=sample_offsets)
    assert_equals(len(patches), 136)
def test_squared_even_patches_single_array():
    image = mio.import_builtin_asset("breakingbad.jpg")
    patch_shape = (16, 16)
    patches = image.extract_patches(
        image.landmarks["PTS"], as_single_array=True, patch_shape=patch_shape
    )
    assert patches.shape, (68, 1 == 3) + patch_shape
def test_uint8_type_single_array():
    image = mio.import_builtin_asset("breakingbad.jpg", normalize=False)
    patch_shape = (16, 16)
    patches = image.extract_patches(
        image.landmarks["PTS"], patch_shape=patch_shape, as_single_array=True
    )
    assert patches.dtype == np.uint8
Beispiel #21
0
def test_lenna_import():
    img = mio.import_builtin_asset("lenna.png")
    assert img.shape == (512, 512)
    assert img.n_channels == 3
    assert img.landmarks.n_groups == 2
    assert img.landmarks["LJSON"].n_points == 68
    assert img.landmarks["pupils"].n_points == 2
Beispiel #22
0
def test_squared_even_patches_sample_offsets():
    image = mio.import_builtin_asset('breakingbad.jpg')
    sample_offsets = np.array([[0, 0], [1, 0]])
    patches = image.extract_patches(image.landmarks['PTS'].lms,
                                    sample_offsets=sample_offsets,
                                    as_single_array=False)
    assert_equals(len(patches), 136)
def test_squared_even_patches_landmarks():
    image = mio.import_builtin_asset("breakingbad.jpg")
    patch_shape = (16, 16)
    patches = image.extract_patches_around_landmarks(
        "PTS", patch_shape=patch_shape, as_single_array=False
    )
    assert len(patches) == 68
Beispiel #24
0
def test_squared_even_patches_landmarks():
    image = mio.import_builtin_asset('breakingbad.jpg')
    patch_shape = (16, 16)
    patches = image.extract_patches_around_landmarks('PTS',
                                                     patch_shape=patch_shape,
                                                     as_single_array=False)
    assert_equals(len(patches), 68)
def test_double_type():
    image = mio.import_builtin_asset("breakingbad.jpg")
    patch_shape = (16, 16)
    patches = image.extract_patches(
        image.landmarks["PTS"], patch_shape=patch_shape, as_single_array=False
    )
    assert patches[0].pixels.dtype == np.float64
Beispiel #26
0
def test_float_type():
    image = mio.import_builtin_asset('breakingbad.jpg')
    image.pixels = image.pixels.astype(np.float32)
    patch_shape = (16, 16)
    patches = image.extract_patches(image.landmarks['PTS'].lms,
                                    patch_size=patch_shape)
    assert (patches[0].pixels.dtype == np.float32)
def test_warp_multi():
    rgb_image = mio.import_builtin_asset('takeo.ppm')
    target_transform = Affine.init_identity(2).from_vector(initial_params)
    warped_im = rgb_image.warp_to_mask(template_mask, target_transform)

    assert (warped_im.shape == rgb_template.shape)
    assert_allclose(warped_im.pixels, rgb_template.pixels)
Beispiel #28
0
def test_uint8_type_single_array():
    image = mio.import_builtin_asset('breakingbad.jpg', normalise=False)
    patch_shape = (16, 16)
    patches = image.extract_patches(image.landmarks['PTS'].lms,
                                    patch_shape=patch_shape,
                                    as_single_array=True)
    assert(patches.dtype == np.uint8)
Beispiel #29
0
def test_uint8_type():
    image = mio.import_builtin_asset('breakingbad.jpg', normalize=False)
    patch_shape = (16, 16)
    patches = image.extract_patches(image.landmarks['PTS'],
                                    patch_shape=patch_shape,
                                    as_single_array=False)
    assert (patches[0].pixels.dtype == np.uint8)
def test_float_type():
    image = mio.import_builtin_asset('breakingbad.jpg')
    image.pixels = image.pixels.astype(np.float32)
    patch_shape = (16, 16)
    patches = image.extract_patches(image.landmarks['PTS'].lms,
                                    patch_size=patch_shape)
    assert(patches[0].pixels.dtype == np.float32)
def test_squared_even_patches_single_array():
    image = mio.import_builtin_asset('breakingbad.jpg')
    image = labeller(image, 'PTS', ibug_face_68)
    patch_shape = (16, 16)
    patches = image.extract_patches(image.landmarks['PTS'].lms,
                                    as_single_array=True,
                                    patch_size=patch_shape)
    assert_equals(patches.shape, ((68,) + patch_shape + (3,)))
def test_squared_even_patches_single_array():
    image = mio.import_builtin_asset('breakingbad.jpg')
    image = labeller(image, 'PTS', ibug_face_68)
    patch_shape = (16, 16)
    patches = image.extract_patches(image.landmarks['PTS'].lms,
                                    as_single_array=True,
                                    patch_size=patch_shape)
    assert_equals(patches.shape, ((68, ) + patch_shape + (3, )))
Beispiel #33
0
def test_squared_even_patches_landmarks_label():
    image = mio.import_builtin_asset('breakingbad.jpg')
    image = labeller(image, 'PTS', ibug_face_68)
    patch_shape = (16, 16)
    patches = image.extract_patches_around_landmarks('ibug_face_68',
                                                     label='nose',
                                                     patch_size=patch_shape)
    assert_equals(len(patches), 9)
def test_squared_even_patches_landmarks_label():
    image = mio.import_builtin_asset('breakingbad.jpg')
    image = labeller(image, 'PTS', ibug_face_68)
    patch_shape = (16, 16)
    patches = image.extract_patches_around_landmarks('ibug_face_68',
                                                     label='nose',
                                                     patch_size=patch_shape)
    assert_equals(len(patches), 9)
Beispiel #35
0
def test_ioinfo():
    # choose a random asset (all should have it!)
    img = pio.import_builtin_asset('einstein.jpg')
    path = pio.data_path_to('einstein.jpg')
    assert (img.ioinfo.filepath == path)
    assert (img.ioinfo.filename == 'einstein')
    assert (img.ioinfo.extension == '.jpg')
    assert (img.ioinfo.dir == pio.data_dir_path())
Beispiel #36
0
def test_ioinfo():
    # choose a random asset (all should have it!)
    img = pio.import_builtin_asset('einstein.jpg')
    path = pio.data_path_to('einstein.jpg')
    assert(img.ioinfo.filepath == path)
    assert(img.ioinfo.filename == 'einstein')
    assert(img.ioinfo.extension == '.jpg')
    assert(img.ioinfo.dir == pio.data_dir_path())
Beispiel #37
0
def test_warp_gray_batch():
    rgb_image = mio.import_builtin_asset('takeo.ppm')
    gray_image = rgb_image.as_greyscale()
    target_transform = Affine.init_identity(2).from_vector(initial_params)
    warped_im = gray_image.warp_to_mask(template_mask, target_transform,
                                        batch_size=100)

    assert(warped_im.shape == gray_template.shape)
    assert_allclose(warped_im.pixels, gray_template.pixels)
Beispiel #38
0
def test_warp_gray_batch():
    rgb_image = mio.import_builtin_asset('takeo.ppm')
    gray_image = rgb_image.as_greyscale()
    target_transform = Affine.init_identity(2).from_vector(initial_params)
    warped_im = gray_image.warp_to_mask(template_mask, target_transform,
                                        batch_size=100)

    assert(warped_im.shape == gray_template.shape)
    assert_allclose(warped_im.pixels, gray_template.pixels)
Beispiel #39
0
def test_path():
    # choose a random asset (all should have it!)
    img = mio.import_builtin_asset("einstein.jpg")
    path = mio.data_path_to("einstein.jpg")
    assert img.path == path
    assert img.path.stem == "einstein"
    assert img.path.suffix == ".jpg"
    assert img.path.parent == mio.data_dir_path()
    assert img.path.name == "einstein.jpg"
Beispiel #40
0
def test_path():
    # choose a random asset (all should have it!)
    img = mio.import_builtin_asset('einstein.jpg')
    path = mio.data_path_to('einstein.jpg')
    assert(img.path == path)
    assert(img.path.stem == 'einstein')
    assert(img.path.suffix == '.jpg')
    assert(img.path.parent == mio.data_dir_path())
    assert(img.path.name == 'einstein.jpg')
Beispiel #41
0
def test_path():
    # choose a random asset (all should have it!)
    img = mio.import_builtin_asset('einstein.jpg')
    path = mio.data_path_to('einstein.jpg')
    assert (img.path == path)
    assert (img.path.stem == 'einstein')
    assert (img.path.suffix == '.jpg')
    assert (img.path.parent == mio.data_dir_path())
    assert (img.path.name == 'einstein.jpg')
Beispiel #42
0
def test_json_landmarks_bunny():
    mesh = pio.import_builtin_asset('bunny.obj')
    assert('JSON' in mesh.landmarks.group_labels)
    lms = mesh.landmarks['JSON']
    labels = {'r_eye', 'mouth', 'nose', 'l_eye'}
    assert(len(labels - set(lms.labels)) == 0)
    assert_allclose(lms['l_eye'].lms.points, bunny_l_eye, atol=1e-7)
    assert_allclose(lms['r_eye'].lms.points, bunny_r_eye, atol=1e-7)
    assert_allclose(lms['nose'].lms.points, bunny_nose, atol=1e-7)
    assert_allclose(lms['mouth'].lms.points, bunny_mouth, atol=1e-7)
Beispiel #43
0
def test_json_landmarks_bunny():
    mesh = pio.import_builtin_asset('bunny.obj')
    assert ('JSON' in mesh.landmarks.group_labels)
    lms = mesh.landmarks['JSON']
    labels = {'r_eye', 'mouth', 'nose', 'l_eye'}
    assert (len(labels - set(lms.labels)) == 0)
    assert_allclose(lms['l_eye'].lms.points, bunny_l_eye, atol=1e-7)
    assert_allclose(lms['r_eye'].lms.points, bunny_r_eye, atol=1e-7)
    assert_allclose(lms['nose'].lms.points, bunny_nose, atol=1e-7)
    assert_allclose(lms['mouth'].lms.points, bunny_mouth, atol=1e-7)
Beispiel #44
0
def test_import_asset_james():
    mesh = mio.import_builtin_asset('james.obj')
    assert(isinstance(mesh, TexturedTriMesh))
    assert(isinstance(mesh.points, np.ndarray))
    assert(mesh.points.shape[1] == 3)
    assert(isinstance(mesh.trilist, np.ndarray))
    assert(mesh.trilist.shape[1] == 3)
    assert(isinstance(mesh.texture, MaskedImage))
    print(mesh.tcoords)
    assert(isinstance(mesh.tcoords, PointCloud))
    assert(mesh.tcoords.points.shape[1] == 2)
Beispiel #45
0
def test_import_asset_james():
    mesh = mio.import_builtin_asset('james.obj')
    assert(isinstance(mesh, TexturedTriMesh))
    assert(isinstance(mesh.points, np.ndarray))
    assert(mesh.points.shape[1] == 3)
    assert(isinstance(mesh.trilist, np.ndarray))
    assert(mesh.trilist.shape[1] == 3)
    assert(isinstance(mesh.texture, MaskedImage))
    print mesh.tcoords
    assert(isinstance(mesh.tcoords, PointCloud))
    assert(mesh.tcoords.points.shape[1] == 2)
Beispiel #46
0
def test_offset_argument():
    patch_shape = (5, 6)
    offsets = [(0., 0.), [0., 0.], np.array([[1., 1.]]), None]
    image = mio.import_builtin_asset('breakingbad.jpg')
    patch_center = PointCloud(np.array([[100., 101.], [50., 41.]]))
    patch = np.zeros((2, 1, image.n_channels) + patch_shape)
    patch[0, 0, ...] = np.ones((image.n_channels,) + patch_shape)
    patch[1, 0, ...] = 2 * np.ones((image.n_channels,) + patch_shape)
    for off in offsets:
        image.set_patches(patch, patch_center, offset=off)
        assert_array_equal(image.pixels[:, 98:103, 98:104], patch[0, 0, ...])
        assert_array_equal(image.pixels[:, 48:53, 38:44], patch[1, 0, ...])
def test_offset_argument():
    patch_shape = (5, 6)
    offsets = [(0.0, 0.0), [0.0, 0.0], np.array([[1.0, 1.0]]), None]
    image = mio.import_builtin_asset("breakingbad.jpg")
    patch_center = PointCloud(np.array([[100.0, 101.0], [50.0, 41.0]]))
    patch = np.zeros((2, 1, image.n_channels) + patch_shape)
    patch[0, 0, ...] = np.ones((image.n_channels,) + patch_shape)
    patch[1, 0, ...] = 2 * np.ones((image.n_channels,) + patch_shape)
    for off in offsets:
        image = image.set_patches(patch, patch_center, offset=off)
        assert_array_equal(image.pixels[:, 98:103, 98:104], patch[0, 0, ...])
        assert_array_equal(image.pixels[:, 48:53, 38:44], patch[1, 0, ...])
Beispiel #48
0
def test_constrain_landmarks():
    breaking_bad = mio.import_builtin_asset('breakingbad.jpg')
    breaking_bad.crop_to_landmarks_inplace(boundary=20)
    breaking_bad.constrain_mask_to_landmarks()
    breaking_bad = breaking_bad.resize([50, 50])
    hog = breaking_bad.features.hog(mode='sparse', constrain_landmarks=False)
    x = np.where(hog.landmarks['PTS'].lms.points[:, 0] > hog.shape[1] - 1)
    y = np.where(hog.landmarks['PTS'].lms.points[:, 0] > hog.shape[0] - 1)
    assert_allclose(len(x[0]) + len(y[0]), 12)
    hog = breaking_bad.features.hog(mode='sparse', constrain_landmarks=True)
    x = np.where(hog.landmarks['PTS'].lms.points[:, 0] > hog.shape[1] - 1)
    y = np.where(hog.landmarks['PTS'].lms.points[:, 0] > hog.shape[0] - 1)
    assert_allclose(len(x[0]) + len(y[0]), 0)
def test_constrain_landmarks():
    breaking_bad = mio.import_builtin_asset('breakingbad.jpg')
    breaking_bad.crop_to_landmarks_inplace(boundary=20)
    breaking_bad.constrain_mask_to_landmarks()
    breaking_bad = breaking_bad.resize([50, 50])
    hog = breaking_bad.features.hog(mode='sparse', constrain_landmarks=False)
    x = np.where(hog.landmarks['PTS'].lms.points[:, 0] > hog.shape[1] - 1)
    y = np.where(hog.landmarks['PTS'].lms.points[:, 0] > hog.shape[0] - 1)
    assert_allclose(len(x[0]) + len(y[0]), 12)
    hog = breaking_bad.features.hog(mode='sparse', constrain_landmarks=True)
    x = np.where(hog.landmarks['PTS'].lms.points[:, 0] > hog.shape[1] - 1)
    y = np.where(hog.landmarks['PTS'].lms.points[:, 0] > hog.shape[0] - 1)
    assert_allclose(len(x[0]) + len(y[0]), 0)
Beispiel #50
0
def test_constrain_landmarks():
    breaking_bad = mio.import_builtin_asset('breakingbad.jpg').as_masked()
    breaking_bad = breaking_bad.crop_to_landmarks(boundary=20)
    breaking_bad = breaking_bad.resize([50, 50])
    breaking_bad.constrain_mask_to_landmarks()
    hog_b = hog(breaking_bad, mode='sparse')
    x = np.where(hog_b.landmarks['PTS'].lms.points[:, 0] > hog_b.shape[1] - 1)
    y = np.where(hog_b.landmarks['PTS'].lms.points[:, 0] > hog_b.shape[0] - 1)
    assert_allclose(len(x[0]) + len(y[0]), 12)
    hog_b = hog(breaking_bad, mode='sparse')
    hog_b.constrain_landmarks_to_bounds()
    x = np.where(hog_b.landmarks['PTS'].lms.points[:, 0] > hog_b.shape[1] - 1)
    y = np.where(hog_b.landmarks['PTS'].lms.points[:, 0] > hog_b.shape[0] - 1)
    assert_allclose(len(x[0]) + len(y[0]), 0)
Beispiel #51
0
def test_constrain_landmarks():
    breaking_bad = mio.import_builtin_asset('breakingbad.jpg').as_masked()
    breaking_bad = breaking_bad.crop_to_landmarks(boundary=20)
    breaking_bad = breaking_bad.resize([50, 50])
    breaking_bad.constrain_mask_to_landmarks()
    hog_b = hog(breaking_bad, mode='sparse')
    x = np.where(hog_b.landmarks['PTS'].lms.points[:, 0] > hog_b.shape[1] - 1)
    y = np.where(hog_b.landmarks['PTS'].lms.points[:, 0] > hog_b.shape[0] - 1)
    assert_allclose(len(x[0]) + len(y[0]), 12)
    hog_b = hog(breaking_bad, mode='sparse')
    hog_b.constrain_landmarks_to_bounds()
    x = np.where(hog_b.landmarks['PTS'].lms.points[:, 0] > hog_b.shape[1] - 1)
    y = np.where(hog_b.landmarks['PTS'].lms.points[:, 0] > hog_b.shape[0] - 1)
    assert_allclose(len(x[0]) + len(y[0]), 0)
Beispiel #52
0
def test_breaking_bad_import():
    img = mio.import_builtin_asset('breakingbad.jpg')
    assert(img.shape == (1080, 1920))
    assert(img.n_channels == 3)
    assert(img.landmarks['PTS'].n_landmarks == 68)
Beispiel #53
0
def test_import_image_deprecated_normalise_kwarg():
    with warnings.catch_warnings(record=True) as w:
        img = mio.import_builtin_asset('breakingbad.jpg', normalise=False)
        assert len(w) == 1
    assert img.pixels.dtype == np.uint8
Beispiel #54
0
def test_import_builtin_pts():
    lmarks = mio.import_builtin_asset('einstein.pts')
    assert(lmarks.n_landmarks == 68)
Beispiel #55
0
def test_import_builtin_ljson():
    lmarks = mio.import_builtin_asset('lenna.ljson')
    assert(lmarks.n_landmarks == 68)
Beispiel #56
0
def test_lenna_import():
    img = mio.import_builtin_asset('lenna.png')
    assert(img.shape == (512, 512))
    assert(img.n_channels == 3)
    assert(img.landmarks['LJSON'].n_landmarks == 68)
Beispiel #57
0
def test_einstein_import():
    img = mio.import_builtin_asset('einstein.jpg')
    assert(img.shape == (1024, 817))
    assert(img.n_channels == 1)
    assert(img.landmarks['PTS'].n_landmarks == 68)
Beispiel #58
0
def test_takeo_import():
    img = mio.import_builtin_asset('takeo.ppm')
    assert(img.shape == (225, 150))
    assert(img.n_channels == 3)
    assert(img.landmarks['PTS'].n_landmarks == 68)
Beispiel #59
0
def test_breaking_bad_import_kwargs():
    img = mio.import_builtin_asset('breakingbad.jpg', normalize=False)
    assert(img.pixels.dtype == np.uint8)