本文整理汇总了Python中menpo.shape.PointCloud.as_vector方法的典型用法代码示例。如果您正苦于以下问题:Python PointCloud.as_vector方法的具体用法?Python PointCloud.as_vector怎么用?Python PointCloud.as_vector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类menpo.shape.PointCloud
的用法示例。
在下文中一共展示了PointCloud.as_vector方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_pointcloud_flatten_rebuild
# 需要导入模块: from menpo.shape import PointCloud [as 别名]
# 或者: from menpo.shape.PointCloud import as_vector [as 别名]
def test_pointcloud_flatten_rebuild():
points = np.array([[1, 2, 3], [1, 1, 1]])
pc = PointCloud(points)
flattened = pc.as_vector()
new_pc = pc.from_vector(flattened)
assert np.all(new_pc.n_dims == pc.n_dims)
assert np.all(new_pc.n_points == pc.n_points)
assert np.all(pc.points == new_pc.points)
示例2: sparse_target
# 需要导入模块: from menpo.shape import PointCloud [as 别名]
# 或者: from menpo.shape.PointCloud import as_vector [as 别名]
def sparse_target(self):
r"""
The current sparse `menpo.shape.PointCloud` that this object produces.
:type: `menpo.shape.PointCloud`
"""
sparse_target = PointCloud(self.target.points[:self.n_landmarks])
return self._sparse_instance.from_vector(sparse_target.as_vector())
示例3: mean_pointcloud
# 需要导入模块: from menpo.shape import PointCloud [as 别名]
# 或者: from menpo.shape.PointCloud import as_vector [as 别名]
def mean_pointcloud(pointclouds):
r"""
Compute the mean of a `list` of :map:`PointCloud` or subclass objects.
The list is assumed to be homogeneous i.e all elements of the list are
assumed to belong to the same point cloud subclass just as all elements
are also assumed to have the same number of points and represent
semantically equivalent point clouds.
Parameters
----------
pointclouds: `list` of :map:`PointCloud` or subclass
List of point cloud or subclass objects from which we want to compute
the mean.
Returns
-------
mean_pointcloud : :map:`PointCloud` or subclass
The mean point cloud or subclass.
"""
# make a temporary PointCloud (with copy=False for low overhead)
tmp_pc = PointCloud(sum(pc.points for pc in pointclouds) /
len(pointclouds), copy=False)
# use the type of the first element in the list to rebuild from the vector
return pointclouds[0].from_vector(tmp_pc.as_vector())
示例4: sparse_target
# 需要导入模块: from menpo.shape import PointCloud [as 别名]
# 或者: from menpo.shape.PointCloud import as_vector [as 别名]
def sparse_target(self):
sparse_target = PointCloud(self.target.points[:self.n_landmarks])
return self._sparse_instance.from_vector(sparse_target.as_vector())