本文整理汇总了Python中menpo.io.import_builtin_asset函数的典型用法代码示例。如果您正苦于以下问题:Python import_builtin_asset函数的具体用法?Python import_builtin_asset怎么用?Python import_builtin_asset使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了import_builtin_asset函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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)
开发者ID:HaoyangWang,项目名称:menpo,代码行数:7,代码来源:image_patches_test.py
示例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)
开发者ID:HaoyangWang,项目名称:menpo,代码行数:7,代码来源:image_patches_test.py
示例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)
开发者ID:HaoyangWang,项目名称:menpo,代码行数:7,代码来源:image_patches_test.py
示例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)
开发者ID:grigorisg9gr,项目名称:menpo,代码行数:7,代码来源:image_warp_test.py
示例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))
开发者ID:HaoyangWang,项目名称:menpo,代码行数:7,代码来源:image_patches_test.py
示例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)
开发者ID:HaoyangWang,项目名称:menpo,代码行数:7,代码来源:image_patches_test.py
示例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)
开发者ID:dubzzz,项目名称:menpo,代码行数:7,代码来源:io_test.py
示例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)
开发者ID:HaoyangWang,项目名称:menpo,代码行数:7,代码来源:image_patches_test.py
示例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)
开发者ID:OlivierML,项目名称:menpo,代码行数:7,代码来源:image_extract_patches_test.py
示例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
开发者ID:AshwinRajendraprasad,项目名称:menpo,代码行数:7,代码来源:test_image_patches.py
示例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)
开发者ID:luukhoavn,项目名称:menpo,代码行数:7,代码来源:image_extract_patches_test.py
示例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,))
开发者ID:kod3r,项目名称:menpo,代码行数:7,代码来源:functions_test.py
示例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())
开发者ID:ikassi,项目名称:menpo,代码行数:8,代码来源:io_test.py
示例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,)))
开发者ID:Amos-zq,项目名称:menpo,代码行数:8,代码来源:image_extract_patches_test.py
示例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)
开发者ID:OlivierML,项目名称:menpo,代码行数:8,代码来源:image_extract_patches_test.py
示例16: test_path
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')
开发者ID:dvdm,项目名称:menpo,代码行数:9,代码来源:io_import_test.py
示例17: test_warp_gray_batch
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)
开发者ID:grigorisg9gr,项目名称:menpo,代码行数:9,代码来源:image_warp_test.py
示例18: test_json_landmarks_bunny
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)
开发者ID:ikassi,项目名称:menpo,代码行数:10,代码来源:io_test.py
示例19: test_import_asset_james
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)
开发者ID:dubzzz,项目名称:menpo,代码行数:11,代码来源:io_test.py
示例20: test_offset_argument
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, ...])
开发者ID:HaoyangWang,项目名称:menpo,代码行数:12,代码来源:image_patches_test.py
注:本文中的menpo.io.import_builtin_asset函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论