cpp-toolbox  0.0.1
A toolbox library for C++
Loading...
Searching...
No Matches
susan_keypoints.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cpp-toolbox/cpp-toolbox_export.hpp>
9
10namespace toolbox::pcl
11{
12
21template<typename DataType,
22 typename KNN = kdtree_generic_t<point_t<DataType>, toolbox::metrics::L2Metric<DataType>>>
23class CPP_TOOLBOX_EXPORT susan_keypoint_extractor_t
24 : public base_keypoint_extractor_t<susan_keypoint_extractor_t<DataType, KNN>,
25 DataType,
26 KNN>
27{
28public:
30 DataType,
31 KNN>;
33 using knn_type = typename base_type::knn_type;
37
39
40 // Implementation methods for CRTP
41 std::size_t set_input_impl(const point_cloud& cloud);
42 std::size_t set_input_impl(const point_cloud_ptr& cloud);
43 std::size_t set_knn_impl(const knn_type& knn);
44 std::size_t set_search_radius_impl(data_type radius);
45 void enable_parallel_impl(bool enable);
46
47 indices_vector extract_impl();
48 void extract_impl(indices_vector& keypoint_indices);
49 point_cloud extract_keypoints_impl();
50 void extract_keypoints_impl(point_cloud_ptr output);
51
52 // SUSAN-specific parameters
53 void set_geometric_threshold(data_type threshold) { m_geometric_threshold = threshold; }
54 void set_angular_threshold(data_type threshold) { m_angular_threshold = threshold; }
55 void set_susan_threshold(data_type threshold) { m_susan_threshold = threshold; }
56 void set_non_maxima_radius(data_type radius) { m_non_maxima_radius = radius; }
57 void set_use_normal_similarity(bool use) { m_use_normal_similarity = use; }
58
59 [[nodiscard]] data_type get_geometric_threshold() const { return m_geometric_threshold; }
60 [[nodiscard]] data_type get_angular_threshold() const { return m_angular_threshold; }
61 [[nodiscard]] data_type get_susan_threshold() const { return m_susan_threshold; }
62 [[nodiscard]] data_type get_non_maxima_radius() const { return m_non_maxima_radius; }
63 [[nodiscard]] bool get_use_normal_similarity() const { return m_use_normal_similarity; }
64
65private:
66 struct SUSANInfo
67 {
68 data_type susan_value; // USAN area
69 bool is_valid;
70 };
71
72 struct NormalInfo
73 {
74 data_type nx, ny, nz;
75 bool is_valid;
76 };
77
78 // Core computation methods
79 SUSANInfo compute_susan_response(std::size_t point_idx, const std::vector<NormalInfo>& normals);
80 std::vector<SUSANInfo> compute_all_susan_responses(const std::vector<NormalInfo>& normals);
81 std::vector<NormalInfo> compute_normals();
82 indices_vector apply_non_maxima_suppression(const std::vector<SUSANInfo>& susan_responses);
83
84 void compute_susan_range(std::vector<SUSANInfo>& susan_responses,
85 const std::vector<NormalInfo>& normals,
86 std::size_t start_idx,
87 std::size_t end_idx);
88
89 // Member variables
90 bool m_enable_parallel = false;
91 data_type m_search_radius = static_cast<data_type>(1.0);
92 data_type m_geometric_threshold = static_cast<data_type>(0.1); // For geometric distance
93 data_type m_angular_threshold = static_cast<data_type>(0.984); // cos(10 degrees)
94 data_type m_susan_threshold = static_cast<data_type>(0.5); // SUSAN area threshold
95 data_type m_non_maxima_radius = static_cast<data_type>(0.5);
96 bool m_use_normal_similarity = true; // Use normal-based similarity by default
97
98 point_cloud_ptr m_cloud;
99 knn_type* m_knn = nullptr;
100
101 // Parallel processing threshold
102 static constexpr std::size_t k_parallel_threshold = 1000;
103}; // class susan_keypoint_extractor_t
104
105} // namespace toolbox::pcl
106
Definition vector_metrics.hpp:18
关键点提取器的基类,使用CRTP模式实现静态多态 / Base class for keypoint extractors using CRTP pattern for static polymorph...
Definition base_feature_extractor.hpp:44
DataType data_type
Definition base_feature_extractor.hpp:46
KNN knn_type
Definition base_feature_extractor.hpp:47
std::vector< std::size_t > indices_vector
Definition base_feature_extractor.hpp:50
std::shared_ptr< toolbox::types::point_cloud_t< data_type > > point_cloud_ptr
Definition base_feature_extractor.hpp:49
SUSAN (Smallest Univalue Segment Assimilating Nucleus) 3D关键点提取器 / SUSAN (Smallest Univalue Segment As...
Definition susan_keypoints.hpp:27
data_type get_geometric_threshold() const
Definition susan_keypoints.hpp:59
void set_non_maxima_radius(data_type radius)
Definition susan_keypoints.hpp:56
data_type get_susan_threshold() const
Definition susan_keypoints.hpp:61
typename base_type::data_type data_type
Definition susan_keypoints.hpp:32
void set_use_normal_similarity(bool use)
Definition susan_keypoints.hpp:57
typename base_type::point_cloud point_cloud
Definition susan_keypoints.hpp:34
typename base_type::knn_type knn_type
Definition susan_keypoints.hpp:33
typename base_type::point_cloud_ptr point_cloud_ptr
Definition susan_keypoints.hpp:35
data_type get_angular_threshold() const
Definition susan_keypoints.hpp:60
typename base_type::indices_vector indices_vector
Definition susan_keypoints.hpp:36
bool get_use_normal_similarity() const
Definition susan_keypoints.hpp:63
void set_angular_threshold(data_type threshold)
Definition susan_keypoints.hpp:54
data_type get_non_maxima_radius() const
Definition susan_keypoints.hpp:62
void set_susan_threshold(data_type threshold)
Definition susan_keypoints.hpp:55
void set_geometric_threshold(data_type threshold)
Definition susan_keypoints.hpp:53
包含点和相关数据的点云类 / A point cloud class containing points and associated data
Definition point.hpp:268
Definition base_correspondence_generator.hpp:18