本文整理汇总了Python中menpo.shape.PointCloud.init_2d_grid方法的典型用法代码示例。如果您正苦于以下问题:Python PointCloud.init_2d_grid方法的具体用法?Python PointCloud.init_2d_grid怎么用?Python PointCloud.init_2d_grid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类menpo.shape.PointCloud
的用法示例。
在下文中一共展示了PointCloud.init_2d_grid方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_constrain_landmarks_to_bounds
# 需要导入模块: from menpo.shape import PointCloud [as 别名]
# 或者: from menpo.shape.PointCloud import init_2d_grid [as 别名]
def test_constrain_landmarks_to_bounds():
im = Image.init_blank((10, 10))
im.landmarks['test'] = PointCloud.init_2d_grid((20, 20))
with warnings.catch_warnings():
warnings.simplefilter('ignore')
im.constrain_landmarks_to_bounds()
assert not im.has_landmarks_outside_bounds()
assert_allclose(im.landmarks['test'].lms.bounds(), im.bounds())
示例2: test_register_landmark_importer
# 需要导入模块: from menpo.shape import PointCloud [as 别名]
# 或者: from menpo.shape.PointCloud import init_2d_grid [as 别名]
def test_register_landmark_importer(is_file):
from menpo.shape import PointCloud
lmark = PointCloud.init_2d_grid((1, 1))
def foo_importer(filepath, **kwargs):
return lmark
is_file.return_value = True
with patch.dict(mio.input.extensions.image_landmark_types, {}, clear=True):
mio.register_landmark_importer('.foo', foo_importer)
new_lmark = mio.import_landmark_file('fake.foo')
assert lmark is new_lmark
示例3: test_pointcloud_init_2d_grid_incorrect_type_spacing_raises
# 需要导入模块: from menpo.shape import PointCloud [as 别名]
# 或者: from menpo.shape.PointCloud import init_2d_grid [as 别名]
def test_pointcloud_init_2d_grid_incorrect_type_spacing_raises():
PointCloud.init_2d_grid([10, 10], spacing={})
示例4: test_pointcloud_init_2d_grid_3d_spacing_raises
# 需要导入模块: from menpo.shape import PointCloud [as 别名]
# 或者: from menpo.shape.PointCloud import init_2d_grid [as 别名]
def test_pointcloud_init_2d_grid_3d_spacing_raises():
PointCloud.init_2d_grid([10, 10], spacing=[1, 1, 1])
示例5: test_pointcloud_init_2d_grid_3d_raises
# 需要导入模块: from menpo.shape import PointCloud [as 别名]
# 或者: from menpo.shape.PointCloud import init_2d_grid [as 别名]
def test_pointcloud_init_2d_grid_3d_raises():
PointCloud.init_2d_grid([10, 10, 10])
示例6: test_pointcloud_init_2d_grid_unequal_spacing
# 需要导入模块: from menpo.shape import PointCloud [as 别名]
# 或者: from menpo.shape.PointCloud import init_2d_grid [as 别名]
def test_pointcloud_init_2d_grid_unequal_spacing():
pc = PointCloud.init_2d_grid([10, 10], spacing=(2., 3))
assert pc.n_points == 100
assert pc.n_dims == 2
assert_allclose(pc.range(), [18, 27])
示例7: test_pointcloud_init_2d_grid_single_spacing
# 需要导入模块: from menpo.shape import PointCloud [as 别名]
# 或者: from menpo.shape.PointCloud import init_2d_grid [as 别名]
def test_pointcloud_init_2d_grid_single_spacing():
pc = PointCloud.init_2d_grid([10, 10], spacing=2)
assert pc.n_points == 100
assert pc.n_dims == 2
assert_allclose(pc.range(), [18, 18])
示例8: test_pointcloud_init_2d_grid
# 需要导入模块: from menpo.shape import PointCloud [as 别名]
# 或者: from menpo.shape.PointCloud import init_2d_grid [as 别名]
def test_pointcloud_init_2d_grid():
pc = PointCloud.init_2d_grid([10, 10])
assert pc.n_points == 100
assert pc.n_dims == 2
assert_allclose(pc.range(), [9, 9])
示例9: test_init_from_pointcloud_return_transform
# 需要导入模块: from menpo.shape import PointCloud [as 别名]
# 或者: from menpo.shape.PointCloud import init_2d_grid [as 别名]
def test_init_from_pointcloud_return_transform():
correct_tr = Translation([5, 5])
pc = correct_tr.apply(PointCloud.init_2d_grid((10, 10)))
im, tr = Image.init_from_pointcloud(pc, return_transform=True)
assert im.shape == (9, 9)
assert_allclose(tr.as_vector(), -correct_tr.as_vector())
示例10: test_init_from_pointcloud
# 需要导入模块: from menpo.shape import PointCloud [as 别名]
# 或者: from menpo.shape.PointCloud import init_2d_grid [as 别名]
def test_init_from_pointcloud():
pc = PointCloud.init_2d_grid((10, 10))
im = Image.init_from_pointcloud(pc)
assert im.shape == (9, 9)
示例11: test_init_from_pointcloud_boundary
# 需要导入模块: from menpo.shape import PointCloud [as 别名]
# 或者: from menpo.shape.PointCloud import init_2d_grid [as 别名]
def test_init_from_pointcloud_boundary():
pc = PointCloud.init_2d_grid((10, 10))
im = Image.init_from_pointcloud(pc, boundary=5)
print(im.shape)
assert im.shape == (19, 19)
示例12: test_init_from_pointcloud_attach_group
# 需要导入模块: from menpo.shape import PointCloud [as 别名]
# 或者: from menpo.shape.PointCloud import init_2d_grid [as 别名]
def test_init_from_pointcloud_attach_group():
pc = PointCloud.init_2d_grid((10, 10))
im = Image.init_from_pointcloud(pc, group='test')
assert im.shape == (9, 9)
assert im.n_landmark_groups == 1
示例13: test_pointcloud_init_2d_grid_3d_raises
# 需要导入模块: from menpo.shape import PointCloud [as 别名]
# 或者: from menpo.shape.PointCloud import init_2d_grid [as 别名]
def test_pointcloud_init_2d_grid_3d_raises():
with raises(ValueError):
PointCloud.init_2d_grid([10, 10, 10])