itk-fpfh 0.2.0

Creator: bigcodingguy24

Last updated:

Add to Cart

Description:

itkfpfh 0.2.0

ITKFPFH


Overview



Module to calculate FPFH feature for a pointset.
Sample Usage is shown below:
# normal_pointset is ITK Pointset which contains normal vector for each point
# pointset is ITK Pointset which contains the input points for which feature needs to be calculated

# normal_np is numpy array of shape [Nx3]
# fpfh_feature is numpy array of shape [33xN]
# 25 is the radius and 100 is the maximum number of neighbors

pointset = itk.PointSet[itk.F, 3].New()
normal_pointset = itk.PointSet[itk.F, 3].New()

normal_pointset.SetPoints(itk.vector_container_from_array(normal_np.flatten()))
fpfh = itk.Fpfh.PointFeature.MF3MF3.New()
fpfh.ComputeFPFHFeature(pointset, normal_pointset, 25, 100)
fpfh_feature = fpfh.GetFpfhFeature()
fpfh_feature = itk.array_from_vector_container(fpfh_feature)
fpfh_feature = np.reshape(fpfh_feature, [33, pointset.GetNumberOfPoints()])

One can obtain the normals using the following code:
def getnormals_pca(inputPoints):
import vtk
from vtk.util import numpy_support
meshPoints = numpy_to_vtk_polydata(inputPoints)
normals = vtk.vtkPCANormalEstimation()
normals.SetSampleSize(30)
normals.SetFlipNormals(True)
#normals.SetNormalOrientationToPoint()
normals.SetNormalOrientationToGraphTraversal()
normals.SetInputData(meshPoints)
normals.Update()
as_numpy = numpy_support.vtk_to_numpy(normals.GetOutput().GetPointData().GetArray(0))
return as_numpy

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.