Point Cloud Library (PCL) 1.12.0
Loading...
Searching...
No Matches
agast_2d.h
1/*
2 * Software License Agreement (BSD License)
3 *
4 * Point Cloud Library (PCL) - www.pointclouds.org
5 * Copyright (c) 2010-2011, Willow Garage, Inc.
6 * Copyright (c) 2012-, Open Perception, Inc.
7 *
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 *
14 * * Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * * Redistributions in binary form must reproduce the above
17 * copyright notice, this list of conditions and the following
18 * disclaimer in the documentation and/or other materials provided
19 * with the distribution.
20 * * Neither the name of Willow Garage, Inc. nor the names of its
21 * contributors may be used to endorse or promote products derived
22 * from this software without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 *
37 */
38
39#pragma once
40
41#include <array>
42
43#include <pcl/point_cloud.h>
44#include <pcl/point_types.h>
45#include <pcl/keypoints/keypoint.h>
46#include <pcl/common/intensity.h>
47#include <pcl/common/io.h> // for copyPointCloud
48
49namespace pcl
50{
51 namespace keypoints
52 {
53 namespace agast
54 {
55
56 /** \brief Abstract detector class for AGAST corner point detectors.
57 *
58 * Adapted from the C++ implementation of Elmar Mair
59 * (http://www6.in.tum.de/Main/ResearchAgast).
60 *
61 * \author Stefan Holzer
62 * \ingroup keypoints
63 */
64 class PCL_EXPORTS AbstractAgastDetector
65 {
66 public:
69
70 /** \brief Constructor.
71 * \param[in] width the width of the image to process
72 * \param[in] height the height of the image to process
73 * \param[in] threshold the corner detection threshold
74 * \param[in] bmax the max image value (default: 255)
75 */
76 AbstractAgastDetector (const std::size_t width,
77 const std::size_t height,
78 const double threshold,
79 const double bmax)
80 : width_ (width)
81 , height_ (height)
82 , threshold_ (threshold)
83 , nr_max_keypoints_ (std::numeric_limits<unsigned int>::max ())
84 , bmax_ (bmax)
85 {}
86
87 /** \brief Destructor. */
89
90 /** \brief Detects corner points.
91 * \param intensity_data
92 * \param output
93 */
94 void
95 detectKeypoints (const std::vector<unsigned char> &intensity_data,
97
98 /** \brief Detects corner points.
99 * \param intensity_data
100 * \param output
101 */
102 void
103 detectKeypoints (const std::vector<float> &intensity_data,
105
106 /** \brief Applies non-max-suppression.
107 * \param[in] intensity_data the image data
108 * \param[in] input the keypoint positions
109 * \param[out] output the resultant keypoints after non-max-supression
110 */
111 void
112 applyNonMaxSuppression (const std::vector<unsigned char>& intensity_data,
115
116 /** \brief Applies non-max-suppression.
117 * \param[in] intensity_data the image data
118 * \param[in] input the keypoint positions
119 * \param[out] output the resultant keypoints after non-max-supression
120 */
121 void
122 applyNonMaxSuppression (const std::vector<float>& intensity_data,
125
126 /** \brief Computes corner score.
127 * \param[in] im the pixels to compute the score at
128 */
129 virtual int
130 computeCornerScore (const unsigned char* im) const = 0;
131
132 /** \brief Computes corner score.
133 * \param[in] im the pixels to compute the score at
134 */
135 virtual int
136 computeCornerScore (const float* im) const = 0;
137
138 /** \brief Sets the threshold for corner detection.
139 * \param[in] threshold the threshold used for corner detection.
140 */
141 inline void
142 setThreshold (const double threshold)
143 {
144 threshold_ = threshold;
145 }
146
147 /** \brief Get the threshold for corner detection, as set by the user. */
148 inline double
150 {
151 return (threshold_);
152 }
153
154 /** \brief Sets the maximum number of keypoints to return. The
155 * estimated keypoints are sorted by their internal score.
156 * \param[in] nr_max_keypoints set the maximum number of keypoints to return
157 */
158 inline void
160 {
161 nr_max_keypoints_ = nr_max_keypoints;
162 }
163
164 /** \brief Get the maximum number of keypoints to return, as set by the user. */
165 inline unsigned int
167 {
168 return (nr_max_keypoints_);
169 }
170
171 /** \brief Detects points of interest (i.e., keypoints) in the given image
172 * \param[in] im the image to detect keypoints in
173 * \param[out] corners_all the resultant set of keypoints detected
174 */
175 virtual void
176 detect (const unsigned char* im,
177 std::vector<pcl::PointUV, Eigen::aligned_allocator<pcl::PointUV> > &corners_all) const = 0;
178
179 /** \brief Detects points of interest (i.e., keypoints) in the given image
180 * \param[in] im the image to detect keypoints in
181 */
182 virtual void
183 detect (const float* im,
184 std::vector<pcl::PointUV, Eigen::aligned_allocator<pcl::PointUV> > &) const = 0;
185
186 protected:
187
188 /** \brief Structure holding an index and the associated keypoint score. */
190 {
191 int idx;
192 int score;
193 };
194
195 /** \brief Score index comparator. */
197 {
198 /** \brief Comparator
199 * \param[in] i1 the first score index
200 * \param[in] i2 the second score index
201 */
202 inline bool
203 operator() (const ScoreIndex &i1, const ScoreIndex &i2)
204 {
205 return (i1.score > i2.score);
206 }
207 };
208
209 /** \brief Initializes the sample pattern. */
210 virtual void
212
213 /** \brief Non-max-suppression helper method.
214 * \param[in] input the keypoint positions
215 * \param[in] scores the keypoint scores computed on the image data
216 * \param[out] output the resultant keypoints after non-max-supression
217 */
218 void
220 const std::vector<ScoreIndex>& scores,
222
223 /** \brief Computes corner scores for the specified points.
224 * \param im
225 * \param corners_all
226 * \param scores
227 */
228 void
229 computeCornerScores (const unsigned char* im,
230 const std::vector<pcl::PointUV, Eigen::aligned_allocator<pcl::PointUV> > & corners_all,
231 std::vector<ScoreIndex> & scores) const;
232
233 /** \brief Computes corner scores for the specified points.
234 * \param im
235 * \param corners_all
236 * \param scores
237 */
238 void
239 computeCornerScores (const float* im,
240 const std::vector<pcl::PointUV, Eigen::aligned_allocator<pcl::PointUV> > & corners_all,
241 std::vector<ScoreIndex> & scores) const;
242
243 /** \brief Width of the image to process. */
244 std::size_t width_;
245 /** \brief Height of the image to process. */
246 std::size_t height_;
247
248 /** \brief Threshold for corner detection. */
250
251 /** \brief The maximum number of keypoints to return. */
252 unsigned int nr_max_keypoints_;
253
254 /** \brief Max image value. */
255 double bmax_;
256 };
257
258 /** \brief Detector class for AGAST corner point detector (7_12s).
259 *
260 * Adapted from the C++ implementation of Elmar Mair
261 * (http://www6.in.tum.de/Main/ResearchAgast).
262 *
263 * \author Stefan Holzer
264 * \ingroup keypoints
265 */
266 class PCL_EXPORTS AgastDetector7_12s : public AbstractAgastDetector
267 {
268 public:
271
272 /** \brief Constructor.
273 * \param[in] width the width of the image to process
274 * \param[in] height the height of the image to process
275 * \param[in] threshold the corner detection threshold
276 * \param[in] bmax the max image value (default: 255)
277 */
278 AgastDetector7_12s (const std::size_t width,
279 const std::size_t height,
280 const double threshold,
281 const double bmax = 255)
282 : AbstractAgastDetector (width, height, threshold, bmax)
283 {
284 initPattern ();
285 }
286
287 /** \brief Destructor. */
289
290 /** \brief Computes corner score.
291 * \param im
292 */
293 int
294 computeCornerScore (const unsigned char* im) const override;
295
296 /** \brief Computes corner score.
297 * \param im
298 */
299 int
300 computeCornerScore (const float* im) const override;
301
302 /** \brief Detects points of interest (i.e., keypoints) in the given image
303 * \param[in] im the image to detect keypoints in
304 * \param[out] corners_all the resultant set of keypoints detected
305 */
306 void
307 detect (const unsigned char* im, std::vector<pcl::PointUV, Eigen::aligned_allocator<pcl::PointUV> > &corners_all) const override;
308
309 /** \brief Detects points of interest (i.e., keypoints) in the given image
310 * \param[in] im the image to detect keypoints in
311 * \param[out] corners_all the resultant set of keypoints detected
312 */
313 void
314 detect (const float* im, std::vector<pcl::PointUV, Eigen::aligned_allocator<pcl::PointUV> > &corners_all) const override;
315
316 protected:
317 /** \brief Initializes the sample pattern. */
318 void
319 initPattern () override;
320
321 private:
322 /** \brief Border width. */
323 static const int border_width_ = 2;
324
325 // offsets defining the sample pattern
326 std::array<std::int_fast16_t, 12> offset_;
327 };
328
329 /** \brief Detector class for AGAST corner point detector (5_8).
330 *
331 * Adapted from the C++ implementation of Elmar Mair
332 * (http://www6.in.tum.de/Main/ResearchAgast).
333 *
334 * \author Stefan Holzer
335 * \ingroup keypoints
336 */
337 class PCL_EXPORTS AgastDetector5_8 : public AbstractAgastDetector
338 {
339 public:
342
343 /** \brief Constructor.
344 * \param[in] width the width of the image to process
345 * \param[in] height the height of the image to process
346 * \param[in] threshold the corner detection threshold
347 * \param[in] bmax the max image value (default: 255)
348 */
349 AgastDetector5_8 (const std::size_t width,
350 const std::size_t height,
351 const double threshold,
352 const double bmax = 255)
353 : AbstractAgastDetector (width, height, threshold, bmax)
354 {
355 initPattern ();
356 }
357
358 /** \brief Destructor. */
360
361 /** \brief Computes corner score.
362 * \param im
363 */
364 int
365 computeCornerScore (const unsigned char* im) const override;
366
367 /** \brief Computes corner score.
368 * \param im
369 */
370 int
371 computeCornerScore (const float* im) const override;
372
373 /** \brief Detects points of interest (i.e., keypoints) in the given image
374 * \param[in] im the image to detect keypoints in
375 * \param[out] corners_all the resultant set of keypoints detected
376 */
377 void
378 detect (const unsigned char* im, std::vector<pcl::PointUV, Eigen::aligned_allocator<pcl::PointUV> > &corners_all) const override;
379
380 /** \brief Detects points of interest (i.e., keypoints) in the given image
381 * \param[in] im the image to detect keypoints in
382 * \param[out] corners_all the resultant set of keypoints detected
383 */
384 void
385 detect (const float* im, std::vector<pcl::PointUV, Eigen::aligned_allocator<pcl::PointUV> > &corners_all) const override;
386
387 protected:
388 /** \brief Initializes the sample pattern. */
389 void
390 initPattern () override;
391
392 private:
393 /** \brief Border width. */
394 static const int border_width_ = 1;
395
396 // offsets defining the sample pattern
397 std::array<std::int_fast16_t, 8> offset_;
398 };
399
400 /** \brief Detector class for AGAST corner point detector (OAST 9_16).
401 *
402 * Adapted from the C++ implementation of Elmar Mair
403 * (http://www6.in.tum.de/Main/ResearchAgast).
404 *
405 * \author Stefan Holzer
406 * \ingroup keypoints
407 */
408 class PCL_EXPORTS OastDetector9_16 : public AbstractAgastDetector
409 {
410 public:
413
414 /** \brief Constructor.
415 * \param[in] width the width of the image to process
416 * \param[in] height the height of the image to process
417 * \param[in] threshold the corner detection threshold
418 * \param[in] bmax the max image value (default: 255)
419 */
420 OastDetector9_16 (const std::size_t width,
421 const std::size_t height,
422 const double threshold,
423 const double bmax = 255)
424 : AbstractAgastDetector (width, height, threshold, bmax)
425 {
426 initPattern ();
427 }
428
429 /** \brief Destructor. */
431
432 /** \brief Computes corner score.
433 * \param im
434 */
435 int
436 computeCornerScore (const unsigned char* im) const override;
437
438 /** \brief Computes corner score.
439 * \param im
440 */
441 int
442 computeCornerScore (const float* im) const override;
443
444 /** \brief Detects points of interest (i.e., keypoints) in the given image
445 * \param[in] im the image to detect keypoints in
446 * \param[out] corners_all the resultant set of keypoints detected
447 */
448 void
449 detect (const unsigned char* im, std::vector<pcl::PointUV, Eigen::aligned_allocator<pcl::PointUV> > &corners_all) const override;
450
451 /** \brief Detects points of interest (i.e., keypoints) in the given image
452 * \param[in] im the image to detect keypoints in
453 * \param[out] corners_all the resultant set of keypoints detected
454 */
455 void
456 detect (const float* im, std::vector<pcl::PointUV, Eigen::aligned_allocator<pcl::PointUV> > &corners_all) const override;
457
458 protected:
459 /** \brief Initializes the sample pattern. */
460 void
461 initPattern () override;
462
463 private:
464 /** \brief Border width. */
465 static const int border_width_ = 3;
466
467 // offsets defining the sample pattern
468 std::array<std::int_fast16_t, 16> offset_;
469 };
470 } // namespace agast
471 } // namespace keypoints
472
473 /////////////////////////////////////////////////////////////////////////////////////////
474 /////////////////////////////////////////////////////////////////////////////////////////
475 /////////////////////////////////////////////////////////////////////////////////////////
476 namespace keypoints
477 {
478 namespace internal
479 {
480 /////////////////////////////////////////////////////////////////////////////////////
481 template <typename Out>
495
496 /////////////////////////////////////////////////////////////////////////////////////
497 template <>
509 /////////////////////////////////////////////////////////////////////////////////////
510 template <typename Out>
523
524 /////////////////////////////////////////////////////////////////////////////////////
525 template <>
527 {
529 const std::vector<unsigned char> &image_data,
532 {
533 detector->detectKeypoints (image_data, output);
534 }
535 };
536 } // namespace agast
537 } // namespace keypoints
538
539 /////////////////////////////////////////////////////////////////////////////////////////
540 /////////////////////////////////////////////////////////////////////////////////////////
541 /////////////////////////////////////////////////////////////////////////////////////////
542 /** \brief Detects 2D AGAST corner points. Based on the original work and
543 * paper reference by
544 *
545 * \par
546 * Elmar Mair, Gregory D. Hager, Darius Burschka, Michael Suppa, and Gerhard Hirzinger.
547 * Adaptive and generic corner detection based on the accelerated segment test.
548 * In Proceedings of the European Conference on Computer Vision (ECCV'10), September 2010.
549 *
550 * \note This is an abstract base class. All children must implement a detectKeypoints method, based on the type of AGAST keypoint to be used.
551 *
552 * \author Stefan Holzer, Radu B. Rusu
553 * \ingroup keypoints
554 */
555 template <typename PointInT, typename PointOutT, typename IntensityT = pcl::common::IntensityFieldAccessor<PointInT> >
556 class AgastKeypoint2DBase : public Keypoint<PointInT, PointOutT>
557 {
558 public:
562 using PointCloudInConstPtr = typename PointCloudIn::ConstPtr;
563
565
570
571 /** \brief Constructor */
573 : threshold_ (10)
575 , bmax_ (255)
577 {
578 k_ = 1;
579 }
580
581 /** \brief Destructor. */
583 {
584 }
585
586 /** \brief Sets the threshold for corner detection.
587 * \param[in] threshold the threshold used for corner detection.
588 */
589 inline void
590 setThreshold (const double threshold)
591 {
592 threshold_ = threshold;
593 }
594
595 /** \brief Get the threshold for corner detection, as set by the user. */
596 inline double
598 {
599 return (threshold_);
600 }
601
602 /** \brief Sets the maximum number of keypoints to return. The
603 * estimated keypoints are sorted by their internal score.
604 * \param[in] nr_max_keypoints set the maximum number of keypoints to return
605 */
606 inline void
611
612 /** \brief Get the maximum number of keypoints to return, as set by the user. */
613 inline unsigned int
615 {
616 return (nr_max_keypoints_);
617 }
618
619 /** \brief Sets the max image data value (affects how many iterations AGAST does)
620 * \param[in] bmax the max image data value
621 */
622 inline void
623 setMaxDataValue (const double bmax)
624 {
625 bmax_ = bmax;
626 }
627
628 /** \brief Get the bmax image value, as set by the user. */
629 inline double
631 {
632 return (bmax_);
633 }
634
635 /** \brief Sets whether non-max-suppression is applied or not.
636 * \param[in] enabled determines whether non-max-suppression is enabled.
637 */
638 inline void
643
644 /** \brief Returns whether non-max-suppression is applied or not. */
645 inline bool
650
651 inline void
656
657 inline AgastDetectorPtr
659 {
660 return (detector_);
661 }
662 protected:
663
664 /** \brief Initializes everything and checks whether input data is fine. */
665 bool
666 initCompute () override;
667
668 /** \brief Detects the keypoints.
669 * \param[out] output the resultant keypoints
670 */
671 void
673
674 /** \brief Intensity field accessor. */
676
677 /** \brief Threshold for corner detection. */
679
680 /** \brief Determines whether non-max-suppression is activated. */
682
683 /** \brief Max image value. */
684 double bmax_;
685
686 /** \brief The Agast detector to use. */
688
689 /** \brief The maximum number of keypoints to return. */
690 unsigned int nr_max_keypoints_;
691 };
692
693 /** \brief Detects 2D AGAST corner points. Based on the original work and
694 * paper reference by
695 *
696 * \par
697 * Elmar Mair, Gregory D. Hager, Darius Burschka, Michael Suppa, and Gerhard Hirzinger.
698 * Adaptive and generic corner detection based on the accelerated segment test.
699 * In Proceedings of the European Conference on Computer Vision (ECCV'10), September 2010.
700 *
701 * Code example:
702 *
703 * \code
704 * pcl::PointCloud<pcl::PointXYZRGBA> cloud;
705 * pcl::AgastKeypoint2D<pcl::PointXYZRGBA> agast;
706 * agast.setThreshold (30);
707 * agast.setInputCloud (cloud);
708 *
709 * PointCloud<pcl::PointUV> keypoints;
710 * agast.compute (keypoints);
711 * \endcode
712 *
713 * \note The AGAST keypoint type used is 7_12s.
714 *
715 * \author Stefan Holzer, Radu B. Rusu
716 * \ingroup keypoints
717 */
718 template <typename PointInT, typename PointOutT = pcl::PointUV>
753
754 /** \brief Detects 2D AGAST corner points. Based on the original work and
755 * paper reference by
756 *
757 * \par
758 * Elmar Mair, Gregory D. Hager, Darius Burschka, Michael Suppa, and Gerhard Hirzinger.
759 * Adaptive and generic corner detection based on the accelerated segment test.
760 * In Proceedings of the European Conference on Computer Vision (ECCV'10), September 2010.
761 *
762 * Code example:
763 *
764 * \code
765 * pcl::PointCloud<pcl::PointXYZRGBA> cloud;
766 * pcl::AgastKeypoint2D<pcl::PointXYZRGBA> agast;
767 * agast.setThreshold (30);
768 * agast.setInputCloud (cloud);
769 *
770 * PointCloud<pcl::PointUV> keypoints;
771 * agast.compute (keypoints);
772 * \endcode
773 *
774 * \note This is a specialized version for PointXYZ clouds, and operates on depth (z) as float. The output keypoints are of the PointXY type.
775 * \note The AGAST keypoint type used is 7_12s.
776 *
777 * \author Stefan Holzer, Radu B. Rusu
778 * \ingroup keypoints
779 */
780 template <>
782 : public AgastKeypoint2DBase<pcl::PointXYZ, pcl::PointUV, pcl::common::IntensityFieldAccessor<pcl::PointXYZ> >
783 {
784 public:
785 /** \brief Constructor */
787 {
788 name_ = "AgastKeypoint2D";
789 bmax_ = 4; // max data value for an OpenNI camera
790 }
791
792 /** \brief Destructor. */
794 {
795 }
796
797 protected:
798 /** \brief Detects the keypoints.
799 * \param[out] output the resultant keypoints
800 */
801 void
803 };
804
805}
806
807#include <pcl/keypoints/impl/agast_2d.hpp>
void detectKeypoints(pcl::PointCloud< pcl::PointUV > &output) override
Detects the keypoints.
Detects 2D AGAST corner points.
Definition agast_2d.h:557
AgastDetectorPtr getAgastDetector()
Definition agast_2d.h:658
typename Keypoint< PointInT, PointOutT >::PointCloudOut PointCloudOut
Definition agast_2d.h:560
double getThreshold()
Get the threshold for corner detection, as set by the user.
Definition agast_2d.h:597
typename PointCloudIn::ConstPtr PointCloudInConstPtr
Definition agast_2d.h:562
void setMaxDataValue(const double bmax)
Sets the max image data value (affects how many iterations AGAST does)
Definition agast_2d.h:623
double threshold_
Threshold for corner detection.
Definition agast_2d.h:678
typename Keypoint< PointInT, PointOutT >::KdTree KdTree
Definition agast_2d.h:561
void detectKeypoints(PointCloudOut &output) override=0
Detects the keypoints.
IntensityT intensity_
Intensity field accessor.
Definition agast_2d.h:675
~AgastKeypoint2DBase()
Destructor.
Definition agast_2d.h:582
void setMaxKeypoints(const unsigned int nr_max_keypoints)
Sets the maximum number of keypoints to return.
Definition agast_2d.h:607
double bmax_
Max image value.
Definition agast_2d.h:684
double getMaxDataValue()
Get the bmax image value, as set by the user.
Definition agast_2d.h:630
void setThreshold(const double threshold)
Sets the threshold for corner detection.
Definition agast_2d.h:590
bool initCompute() override
Initializes everything and checks whether input data is fine.
Definition agast_2d.hpp:49
void setAgastDetector(const AgastDetectorPtr &detector)
Definition agast_2d.h:652
AgastDetectorPtr detector_
The Agast detector to use.
Definition agast_2d.h:687
unsigned int nr_max_keypoints_
The maximum number of keypoints to return.
Definition agast_2d.h:690
bool getNonMaxSuppression()
Returns whether non-max-suppression is applied or not.
Definition agast_2d.h:646
AgastKeypoint2DBase()
Constructor.
Definition agast_2d.h:572
bool apply_non_max_suppression_
Determines whether non-max-suppression is activated.
Definition agast_2d.h:681
typename Keypoint< PointInT, PointOutT >::PointCloudIn PointCloudIn
Definition agast_2d.h:559
void setNonMaxSuppression(const bool enabled)
Sets whether non-max-suppression is applied or not.
Definition agast_2d.h:639
pcl::keypoints::agast::AbstractAgastDetector::Ptr AgastDetectorPtr
Definition agast_2d.h:564
unsigned int getMaxKeypoints()
Get the maximum number of keypoints to return, as set by the user.
Definition agast_2d.h:614
Detects 2D AGAST corner points.
Definition agast_2d.h:720
~AgastKeypoint2D()
Destructor.
Definition agast_2d.h:742
AgastKeypoint2D()
Constructor.
Definition agast_2d.h:736
typename Keypoint< PointInT, PointOutT >::PointCloudOut PointCloudOut
Definition agast_2d.h:722
void detectKeypoints(PointCloudOut &output) override
Detects the keypoints.
Definition agast_2d.hpp:68
Iterator class for point clouds with or without given indices.
Keypoint represents the base class for key points.
Definition keypoint.h:49
int k_
The number of K nearest neighbors to use for each point.
Definition keypoint.h:190
std::string name_
The key point detection method's name.
Definition keypoint.h:169
PointCloudConstPtr input_
The input point cloud dataset.
Definition pcl_base.h:147
IndicesPtr indices_
A pointer to the vector of point indices to use.
Definition pcl_base.h:150
Abstract detector class for AGAST corner point detectors.
Definition agast_2d.h:65
AbstractAgastDetector(const std::size_t width, const std::size_t height, const double threshold, const double bmax)
Constructor.
Definition agast_2d.h:76
virtual void detect(const float *im, std::vector< pcl::PointUV, Eigen::aligned_allocator< pcl::PointUV > > &) const =0
Detects points of interest (i.e., keypoints) in the given image.
shared_ptr< AbstractAgastDetector > Ptr
Definition agast_2d.h:67
void computeCornerScores(const float *im, const std::vector< pcl::PointUV, Eigen::aligned_allocator< pcl::PointUV > > &corners_all, std::vector< ScoreIndex > &scores) const
Computes corner scores for the specified points.
virtual ~AbstractAgastDetector()
Destructor.
Definition agast_2d.h:88
void setMaxKeypoints(const unsigned int nr_max_keypoints)
Sets the maximum number of keypoints to return.
Definition agast_2d.h:159
double threshold_
Threshold for corner detection.
Definition agast_2d.h:249
void applyNonMaxSuppression(const std::vector< unsigned char > &intensity_data, const pcl::PointCloud< pcl::PointUV > &input, pcl::PointCloud< pcl::PointUV > &output)
Applies non-max-suppression.
void detectKeypoints(const std::vector< float > &intensity_data, pcl::PointCloud< pcl::PointUV > &output) const
Detects corner points.
unsigned int getMaxKeypoints()
Get the maximum number of keypoints to return, as set by the user.
Definition agast_2d.h:166
void setThreshold(const double threshold)
Sets the threshold for corner detection.
Definition agast_2d.h:142
double getThreshold()
Get the threshold for corner detection, as set by the user.
Definition agast_2d.h:149
void detectKeypoints(const std::vector< unsigned char > &intensity_data, pcl::PointCloud< pcl::PointUV > &output) const
Detects corner points.
virtual void initPattern()=0
Initializes the sample pattern.
std::size_t height_
Height of the image to process.
Definition agast_2d.h:246
void computeCornerScores(const unsigned char *im, const std::vector< pcl::PointUV, Eigen::aligned_allocator< pcl::PointUV > > &corners_all, std::vector< ScoreIndex > &scores) const
Computes corner scores for the specified points.
virtual void detect(const unsigned char *im, std::vector< pcl::PointUV, Eigen::aligned_allocator< pcl::PointUV > > &corners_all) const =0
Detects points of interest (i.e., keypoints) in the given image.
void applyNonMaxSuppression(const pcl::PointCloud< pcl::PointUV > &input, const std::vector< ScoreIndex > &scores, pcl::PointCloud< pcl::PointUV > &output)
Non-max-suppression helper method.
unsigned int nr_max_keypoints_
The maximum number of keypoints to return.
Definition agast_2d.h:252
virtual int computeCornerScore(const unsigned char *im) const =0
Computes corner score.
std::size_t width_
Width of the image to process.
Definition agast_2d.h:244
virtual int computeCornerScore(const float *im) const =0
Computes corner score.
void applyNonMaxSuppression(const std::vector< float > &intensity_data, const pcl::PointCloud< pcl::PointUV > &input, pcl::PointCloud< pcl::PointUV > &output)
Applies non-max-suppression.
Detector class for AGAST corner point detector (5_8).
Definition agast_2d.h:338
void initPattern() override
Initializes the sample pattern.
void detect(const float *im, std::vector< pcl::PointUV, Eigen::aligned_allocator< pcl::PointUV > > &corners_all) const override
Detects points of interest (i.e., keypoints) in the given image.
int computeCornerScore(const unsigned char *im) const override
Computes corner score.
int computeCornerScore(const float *im) const override
Computes corner score.
AgastDetector5_8(const std::size_t width, const std::size_t height, const double threshold, const double bmax=255)
Constructor.
Definition agast_2d.h:349
void detect(const unsigned char *im, std::vector< pcl::PointUV, Eigen::aligned_allocator< pcl::PointUV > > &corners_all) const override
Detects points of interest (i.e., keypoints) in the given image.
shared_ptr< AgastDetector5_8 > Ptr
Definition agast_2d.h:340
Detector class for AGAST corner point detector (7_12s).
Definition agast_2d.h:267
void detect(const unsigned char *im, std::vector< pcl::PointUV, Eigen::aligned_allocator< pcl::PointUV > > &corners_all) const override
Detects points of interest (i.e., keypoints) in the given image.
AgastDetector7_12s(const std::size_t width, const std::size_t height, const double threshold, const double bmax=255)
Constructor.
Definition agast_2d.h:278
void detect(const float *im, std::vector< pcl::PointUV, Eigen::aligned_allocator< pcl::PointUV > > &corners_all) const override
Detects points of interest (i.e., keypoints) in the given image.
void initPattern() override
Initializes the sample pattern.
int computeCornerScore(const float *im) const override
Computes corner score.
int computeCornerScore(const unsigned char *im) const override
Computes corner score.
Detector class for AGAST corner point detector (OAST 9_16).
Definition agast_2d.h:409
int computeCornerScore(const float *im) const override
Computes corner score.
void detect(const float *im, std::vector< pcl::PointUV, Eigen::aligned_allocator< pcl::PointUV > > &corners_all) const override
Detects points of interest (i.e., keypoints) in the given image.
void initPattern() override
Initializes the sample pattern.
OastDetector9_16(const std::size_t width, const std::size_t height, const double threshold, const double bmax=255)
Constructor.
Definition agast_2d.h:420
void detect(const unsigned char *im, std::vector< pcl::PointUV, Eigen::aligned_allocator< pcl::PointUV > > &corners_all) const override
Detects points of interest (i.e., keypoints) in the given image.
int computeCornerScore(const unsigned char *im) const override
Computes corner score.
shared_ptr< OastDetector9_16 > Ptr
Definition agast_2d.h:411
Defines all the PCL implemented PointT point type structures.
void copyPointCloud(const pcl::PointCloud< PointInT > &cloud_in, pcl::PointCloud< PointOutT > &cloud_out)
Copy all the fields from a given point cloud into a new point cloud.
Definition io.hpp:144
A 2D point structure representing pixel image coordinates.
A point structure representing Euclidean xyz coordinates.
Structure holding an index and the associated keypoint score.
Definition agast_2d.h:190
AgastApplyNonMaxSuppresion(const std::vector< unsigned char > &image_data, const pcl::PointCloud< pcl::PointUV > &tmp_cloud, const pcl::keypoints::agast::AbstractAgastDetector::Ptr &detector, pcl::PointCloud< pcl::PointUV > &output)
Definition agast_2d.h:500
AgastApplyNonMaxSuppresion(const std::vector< unsigned char > &image_data, const pcl::PointCloud< pcl::PointUV > &tmp_cloud, const pcl::keypoints::agast::AbstractAgastDetector::Ptr &detector, pcl::PointCloud< Out > &output)
Definition agast_2d.h:484
AgastDetector(const std::vector< unsigned char > &image_data, const pcl::keypoints::agast::AbstractAgastDetector::Ptr &detector, pcl::PointCloud< pcl::PointUV > &output)
Definition agast_2d.h:528
AgastDetector(const std::vector< unsigned char > &image_data, const pcl::keypoints::agast::AbstractAgastDetector::Ptr &detector, pcl::PointCloud< Out > &output)
Definition agast_2d.h:513