https://github.com/insightsoftwareconsortium/itkfpfh
Fast Point Feature Histogram
https://github.com/insightsoftwareconsortium/itkfpfh
cpp feature-extraction icp insight-toolkit itk itk-module matching point-cloud python registration
Last synced: 3 months ago
JSON representation
Fast Point Feature Histogram
- Host: GitHub
- URL: https://github.com/insightsoftwareconsortium/itkfpfh
- Owner: InsightSoftwareConsortium
- License: apache-2.0
- Created: 2022-07-11T04:05:06.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2025-03-16T18:04:27.000Z (3 months ago)
- Last Synced: 2025-04-13T03:13:59.674Z (3 months ago)
- Topics: cpp, feature-extraction, icp, insight-toolkit, itk, itk-module, matching, point-cloud, python, registration
- Language: C++
- Homepage:
- Size: 86.9 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
ITKFPFH
=================================[
](https://github.com/InsightSoftwareConsortium/ITKFPFH/actions)
[](https://pypi.python.org/pypi/itk-fpfh)
Overview
--------
![]()
Module to calculate FPFH feature for a pointset.
Sample Usage is shown below:```python
# 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 neighborspointset = 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:
```python
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
```