cpp-toolbox  0.0.1
A toolbox library for C++
Loading...
Searching...
No Matches
agast_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, typename KNN = kdtree_generic_t<point_t<DataType>, toolbox::metrics::L2Metric<DataType>>>
22class CPP_TOOLBOX_EXPORT agast_keypoint_extractor_t
23 : public base_keypoint_extractor_t<agast_keypoint_extractor_t<DataType, KNN>,
24 DataType,
25 KNN>
26{
27public:
29 DataType,
30 KNN>;
32 using knn_type = typename base_type::knn_type;
36
38
39 // Implementation methods for CRTP
40 std::size_t set_input_impl(const point_cloud& cloud);
41 std::size_t set_input_impl(const point_cloud_ptr& cloud);
42 std::size_t set_knn_impl(const knn_type& knn);
43 std::size_t set_search_radius_impl(data_type radius);
44 void enable_parallel_impl(bool enable);
45
46 indices_vector extract_impl();
47 void extract_impl(indices_vector& keypoint_indices);
48 point_cloud extract_keypoints_impl();
49 void extract_keypoints_impl(point_cloud_ptr output);
50
51 // AGAST-specific parameters
52 void set_threshold(data_type threshold) { m_threshold = threshold; }
53 void set_pattern_radius(data_type radius) { m_pattern_radius = radius; }
54 void set_non_maxima_radius(data_type radius) { m_non_maxima_radius = radius; }
55 void set_num_test_points(std::size_t num) { m_num_test_points = num; initialize_test_pattern(); }
56 void set_min_arc_length(std::size_t length) { m_min_arc_length = length; }
57
58 [[nodiscard]] data_type get_threshold() const { return m_threshold; }
59 [[nodiscard]] data_type get_pattern_radius() const { return m_pattern_radius; }
60 [[nodiscard]] data_type get_non_maxima_radius() const { return m_non_maxima_radius; }
61 [[nodiscard]] std::size_t get_num_test_points() const { return m_num_test_points; }
62 [[nodiscard]] std::size_t get_min_arc_length() const { return m_min_arc_length; }
63
64private:
65 struct TestPoint
66 {
67 data_type x, y, z; // Relative position on sphere
68 };
69
70 struct AGASTInfo
71 {
72 data_type score;
73 bool is_keypoint;
74 };
75
76 // Core computation methods
77 void initialize_test_pattern();
78 AGASTInfo compute_agast_response(std::size_t point_idx);
79 std::vector<AGASTInfo> compute_all_agast_responses();
80 indices_vector apply_non_maxima_suppression(const std::vector<AGASTInfo>& agast_responses);
81
82 void compute_agast_range(std::vector<AGASTInfo>& agast_responses,
83 std::size_t start_idx,
84 std::size_t end_idx);
85
86 data_type compute_test_value(const point_t<data_type>& center, const TestPoint& test_point);
87 bool is_consecutive_arc(const std::vector<bool>& brighter, const std::vector<bool>& darker);
88
89 // Member variables
90 bool m_enable_parallel = false;
91 data_type m_threshold = static_cast<data_type>(0.1);
92 data_type m_pattern_radius = static_cast<data_type>(0.5);
93 data_type m_non_maxima_radius = static_cast<data_type>(0.5);
94 std::size_t m_num_test_points = 16; // Number of test points on sphere
95 std::size_t m_min_arc_length = 9; // Minimum consecutive similar points
96
97 std::vector<TestPoint> m_test_pattern; // 3D test pattern on sphere
98
99 point_cloud_ptr m_cloud;
100 knn_type* m_knn = nullptr;
101
102 // Parallel processing threshold
103 static constexpr std::size_t k_parallel_threshold = 1000;
104}; // class agast_keypoint_extractor_t
105
106} // namespace toolbox::pcl
107
AGAST (Adaptive and Generic Accelerated Segment Test) 3D关键点提取器 / AGAST (Adaptive and Generic Accelera...
Definition agast_keypoints.hpp:26
data_type get_non_maxima_radius() const
Definition agast_keypoints.hpp:60
typename base_type::point_cloud_ptr point_cloud_ptr
Definition agast_keypoints.hpp:34
std::size_t get_num_test_points() const
Definition agast_keypoints.hpp:61
void set_num_test_points(std::size_t num)
Definition agast_keypoints.hpp:55
typename base_type::point_cloud point_cloud
Definition agast_keypoints.hpp:33
std::size_t get_min_arc_length() const
Definition agast_keypoints.hpp:62
void set_min_arc_length(std::size_t length)
Definition agast_keypoints.hpp:56
void set_pattern_radius(data_type radius)
Definition agast_keypoints.hpp:53
typename base_type::indices_vector indices_vector
Definition agast_keypoints.hpp:35
typename base_type::knn_type knn_type
Definition agast_keypoints.hpp:32
void set_threshold(data_type threshold)
Definition agast_keypoints.hpp:52
typename base_type::data_type data_type
Definition agast_keypoints.hpp:31
data_type get_threshold() const
Definition agast_keypoints.hpp:58
data_type get_pattern_radius() const
Definition agast_keypoints.hpp:59
void set_non_maxima_radius(data_type radius)
Definition agast_keypoints.hpp:54
关键点提取器的基类,使用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
包含点和相关数据的点云类 / A point cloud class containing points and associated data
Definition point.hpp:268
Definition base_correspondence_generator.hpp:18