itk-fpfh

The feature points could be used obtain salient points while performing registration using RANSAC remote module. The class PointFeature is the main driver that takes a PointSet as argument. Please refer to the documentation for a detailed description and sample usage: https://github.com/InsightSoftwareConsortium/ITKFPFH


Keywords
itk, cpp, feature-extraction, icp, insight-toolkit, itk-module, matching, point-cloud, python, registration
License
Other
Install
pip install itk-fpfh==0.1.0

Documentation

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