本文整理汇总了Python中menpo.shape.PointCloud.norm方法的典型用法代码示例。如果您正苦于以下问题:Python PointCloud.norm方法的具体用法?Python PointCloud.norm怎么用?Python PointCloud.norm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类menpo.shape.PointCloud
的用法示例。
在下文中一共展示了PointCloud.norm方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _recursive_procrustes
# 需要导入模块: from menpo.shape import PointCloud [as 别名]
# 或者: from menpo.shape.PointCloud import norm [as 别名]
def _recursive_procrustes(self):
r"""
Recursively calculates a procrustes alignment.
"""
from menpo.shape import PointCloud
if self.n_iterations > self.max_iterations:
return False
av_aligned_source = sum(t.aligned_source.points for t in self.transforms) / self.n_sources
new_target = PointCloud(av_aligned_source)
# rescale the new_target to be the same size as the original about
# it's centre
rescale = UniformScale(self.initial_target_scale / new_target.norm(), self.n_dims)
centre = Translation(-new_target.centre)
rescale_about_centre = centre.compose_before(rescale).compose_before(centre.pseudoinverse)
rescale_about_centre.apply_inplace(new_target)
# check to see if we have converged yet
delta_target = np.linalg.norm(self.target.points - new_target.points)
if delta_target < 1e-6:
return True
else:
self.n_iterations += 1
for t in self.transforms:
t.set_target(new_target)
self.target = new_target
return self._recursive_procrustes()