gtsam_points
Loading...
Searching...
No Matches
fpfh_estimation.hpp
1// SPDX-License-Identifier: MIT
2// Copyright (c) 2025 Kenji Koide (k.koide@aist.go.jp)
3//
4// The FPFH extraction code is heavily inspired by the implementation in PCL.
5// https://github.com/PointCloudLibrary/pcl/blob/master/features/include/pcl/features/fpfh.h
6
7/*
8 * Software License Agreement (BSD License)
9 *
10 * Point Cloud Library (PCL) - www.pointclouds.org
11 * Copyright (c) 2010-2012, Willow Garage, Inc.
12 * Copyright (c) 2012-, Open Perception, Inc.
13 *
14 * All rights reserved.
15 *
16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted provided that the following conditions
18 * are met:
19 *
20 * * Redistributions of source code must retain the above copyright
21 * notice, this list of conditions and the following disclaimer.
22 * * Redistributions in binary form must reproduce the above
23 * copyright notice, this list of conditions and the following
24 * disclaimer in the documentation and/or other materials provided
25 * with the distribution.
26 * * Neither the name of the copyright holder(s) nor the names of its
27 * contributors may be used to endorse or promote products derived
28 * from this software without specific prior written permission.
29 *
30 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
31 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
32 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
33 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
34 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
35 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
36 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
37 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
38 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
39 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
40 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGE.
42 */
43
44#pragma once
45
46#include <vector>
47#include <Eigen/Core>
48#include <gtsam_points/types/point_cloud.hpp>
49#include <gtsam_points/ann/nearest_neighbor_search.hpp>
50
51namespace gtsam_points {
52
53constexpr int PFH_DIM = 125;
54constexpr int FPFH_DIM = 33;
55
56using PFHSignature = Eigen::Matrix<double, PFH_DIM, 1>;
57using FPFHSignature = Eigen::Matrix<double, FPFH_DIM, 1>;
58
61 double search_radius = 5.0;
62 int max_num_neighbors = 10000;
63 int num_threads = 4;
64};
65
67
70Eigen::Vector4d compute_pair_features(const Eigen::Vector4d& p1, const Eigen::Vector4d& n1, const Eigen::Vector4d& p2, const Eigen::Vector4d& n2);
71
81std::vector<PFHSignature> estimate_pfh(
82 const Eigen::Vector4d* points,
83 const Eigen::Vector4d* normals,
84 int num_points,
85 const int* indices,
86 int num_indices,
87 const NearestNeighborSearch& search,
89
97std::vector<PFHSignature> estimate_pfh(
98 const Eigen::Vector4d* points,
99 const Eigen::Vector4d* normals,
100 int num_points,
101 const NearestNeighborSearch& search,
102 const PFHEstimationParams& params = PFHEstimationParams());
103
113std::vector<FPFHSignature> estimate_fpfh(
114 const Eigen::Vector4d* points,
115 const Eigen::Vector4d* normals,
116 int num_points,
117 const int* indices,
118 int num_indices,
119 const NearestNeighborSearch& search,
121
129std::vector<FPFHSignature> estimate_fpfh(
130 const Eigen::Vector4d* points,
131 const Eigen::Vector4d* normals,
132 int num_points,
133 const NearestNeighborSearch& search,
135
140std::vector<PFHSignature>
141estimate_pfh(const PointCloud& points, const NearestNeighborSearch& search, const PFHEstimationParams& params = PFHEstimationParams());
142
147std::vector<FPFHSignature>
148estimate_fpfh(const PointCloud& points, const NearestNeighborSearch& search, const FPFHEstimationParams& params = FPFHEstimationParams());
149
150} // namespace gtsam_points
Nearest neighbor search interface.
Definition nearest_neighbor_search.hpp:16
PFH estimation parameters.
Definition fpfh_estimation.hpp:60
int max_num_neighbors
Maximum number of neighbors.
Definition fpfh_estimation.hpp:62
double search_radius
Neighbor search radius.
Definition fpfh_estimation.hpp:61
int num_threads
Number of threads.
Definition fpfh_estimation.hpp:63
Standard point cloud class that holds only pointers to point attributes.
Definition point_cloud.hpp:19