def normal_cloud_im(self):
"""Generate a NormalCloudImage from the PointCloudImage.
Returns
-------
:obj:`NormalCloudImage`
The corresponding NormalCloudImage.
"""
gx, gy, _ = np.gradient(self.data)
gx_data = gx.reshape(self.height * self.width, 3)
gy_data = gy.reshape(self.height * self.width, 3)
pc_grads = np.cross(gx_data, gy_data) # default to point toward camera
pc_grad_norms = np.linalg.norm(pc_grads, axis=1)
normal_data = pc_grads / np.tile(pc_grad_norms[:, np.newaxis], [1, 3])
normal_im_data = normal_data.reshape(self.height, self.width, 3)
return NormalCloudImage(normal_im_data, frame=self.frame)
评论列表
文章目录