本文整理汇总了Python中menpo.io.import_builtin_asset函数的典型用法代码示例。如果您正苦于以下问题:Python import_builtin_asset函数的具体用法?Python import_builtin_asset怎么用?Python import_builtin_asset使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了import_builtin_asset函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_uint8_type_single_array
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)
示例2: test_nonsquared_odd_patches
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)
示例3: test_squared_even_patches_sample_offsets
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)
示例4: test_warp_multi
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)
示例5: test_squared_even_patches_single_array
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))
示例6: test_double_type
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)
示例7: test_import_asset_bunny
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)
示例8: test_squared_even_patches_landmarks
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)
示例9: test_squared_even_patches_sample_offsets
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)
示例10: test_nonsquared_even_patches
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
示例11: test_float_type
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)
示例12: test_squared_even_patches
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,))
示例13: test_ioinfo
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())
示例14: test_squared_even_patches_single_array
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,)))
示例15: test_squared_even_patches_landmarks_label
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)