Point Cloud Library (PCL)  1.9.1-dev
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 
48 namespace pcl
49 {
50  namespace keypoints
51  {
52  namespace agast
53  {
54 
55  /** \brief Abstract detector class for AGAST corner point detectors.
56  *
57  * Adapted from the C++ implementation of Elmar Mair
58  * (http://www6.in.tum.de/Main/ResearchAgast).
59  *
60  * \author Stefan Holzer
61  * \ingroup keypoints
62  */
63  class PCL_EXPORTS AbstractAgastDetector
64  {
65  public:
66  using Ptr = boost::shared_ptr<AbstractAgastDetector>;
67  using ConstPtr = boost::shared_ptr<const AbstractAgastDetector>;
68 
69  /** \brief Constructor.
70  * \param[in] width the width of the image to process
71  * \param[in] height the height of the image to process
72  * \param[in] threshold the corner detection threshold
73  * \param[in] bmax the max image value (default: 255)
74  */
75  AbstractAgastDetector (const size_t width,
76  const size_t height,
77  const double threshold,
78  const double bmax)
79  : width_ (width)
80  , height_ (height)
81  , threshold_ (threshold)
82  , nr_max_keypoints_ (std::numeric_limits<unsigned int>::max ())
83  , bmax_ (bmax)
84  {}
85 
86  /** \brief Destructor. */
87  virtual ~AbstractAgastDetector () {}
88 
89  /** \brief Detects corner points.
90  * \param intensity_data
91  * \param output
92  */
93  void
94  detectKeypoints (const std::vector<unsigned char> &intensity_data,
96 
97  /** \brief Detects corner points.
98  * \param intensity_data
99  * \param output
100  */
101  void
102  detectKeypoints (const std::vector<float> &intensity_data,
104 
105  /** \brief Applies non-max-suppression.
106  * \param[in] intensity_data the image data
107  * \param[in] input the keypoint positions
108  * \param[out] output the resultant keypoints after non-max-supression
109  */
110  void
111  applyNonMaxSuppression (const std::vector<unsigned char>& intensity_data,
112  const pcl::PointCloud<pcl::PointUV> &input,
114 
115  /** \brief Applies non-max-suppression.
116  * \param[in] intensity_data the image data
117  * \param[in] input the keypoint positions
118  * \param[out] output the resultant keypoints after non-max-supression
119  */
120  void
121  applyNonMaxSuppression (const std::vector<float>& intensity_data,
122  const pcl::PointCloud<pcl::PointUV> &input,
124 
125  /** \brief Computes corner score.
126  * \param[in] im the pixels to compute the score at
127  */
128  virtual int
129  computeCornerScore (const unsigned char* im) const = 0;
130 
131  /** \brief Computes corner score.
132  * \param[in] im the pixels to compute the score at
133  */
134  virtual int
135  computeCornerScore (const float* im) const = 0;
136 
137  /** \brief Sets the threshold for corner detection.
138  * \param[in] threshold the threshold used for corner detection.
139  */
140  inline void
141  setThreshold (const double threshold)
142  {
143  threshold_ = threshold;
144  }
145 
146  /** \brief Get the threshold for corner detection, as set by the user. */
147  inline double
149  {
150  return (threshold_);
151  }
152 
153  /** \brief Sets the maximum number of keypoints to return. The
154  * estimated keypoints are sorted by their internal score.
155  * \param[in] nr_max_keypoints set the maximum number of keypoints to return
156  */
157  inline void
158  setMaxKeypoints (const unsigned int nr_max_keypoints)
159  {
160  nr_max_keypoints_ = nr_max_keypoints;
161  }
162 
163  /** \brief Get the maximum number of keypoints to return, as set by the user. */
164  inline unsigned int
166  {
167  return (nr_max_keypoints_);
168  }
169 
170  /** \brief Detects points of interest (i.e., keypoints) in the given image
171  * \param[in] im the image to detect keypoints in
172  * \param[out] corners_all the resultant set of keypoints detected
173  */
174  virtual void
175  detect (const unsigned char* im,
176  std::vector<pcl::PointUV, Eigen::aligned_allocator<pcl::PointUV> > &corners_all) const = 0;
177 
178  /** \brief Detects points of interest (i.e., keypoints) in the given image
179  * \param[in] im the image to detect keypoints in
180  */
181  virtual void
182  detect (const float* im,
183  std::vector<pcl::PointUV, Eigen::aligned_allocator<pcl::PointUV> > &) const = 0;
184 
185  protected:
186 
187  /** \brief Structure holding an index and the associated keypoint score. */
188  struct ScoreIndex
189  {
190  int idx;
191  int score;
192  };
193 
194  /** \brief Score index comparator. */
196  {
197  /** \brief Comparator
198  * \param[in] i1 the first score index
199  * \param[in] i2 the second score index
200  */
201  inline bool
202  operator() (const ScoreIndex &i1, const ScoreIndex &i2)
203  {
204  return (i1.score > i2.score);
205  }
206  };
207 
208  /** \brief Initializes the sample pattern. */
209  virtual void
210  initPattern () = 0;
211 
212  /** \brief Non-max-suppression helper method.
213  * \param[in] input the keypoint positions
214  * \param[in] scores the keypoint scores computed on the image data
215  * \param[out] output the resultant keypoints after non-max-supression
216  */
217  void
218  applyNonMaxSuppression (const pcl::PointCloud<pcl::PointUV> &input,
219  const std::vector<ScoreIndex>& scores,
221 
222  /** \brief Computes corner scores for the specified points.
223  * \param im
224  * \param corners_all
225  * \param scores
226  */
227  void
228  computeCornerScores (const unsigned char* im,
229  const std::vector<pcl::PointUV, Eigen::aligned_allocator<pcl::PointUV> > & corners_all,
230  std::vector<ScoreIndex> & scores);
231 
232  /** \brief Computes corner scores for the specified points.
233  * \param im
234  * \param corners_all
235  * \param scores
236  */
237  void
238  computeCornerScores (const float* im,
239  const std::vector<pcl::PointUV, Eigen::aligned_allocator<pcl::PointUV> > & corners_all,
240  std::vector<ScoreIndex> & scores);
241 
242  /** \brief Width of the image to process. */
243  size_t width_;
244  /** \brief Height of the image to process. */
245  size_t height_;
246 
247  /** \brief Threshold for corner detection. */
248  double threshold_;
249 
250  /** \brief The maximum number of keypoints to return. */
251  unsigned int nr_max_keypoints_;
252 
253  /** \brief Max image value. */
254  double bmax_;
255  };
256 
257  /** \brief Detector class for AGAST corner point detector (7_12s).
258  *
259  * Adapted from the C++ implementation of Elmar Mair
260  * (http://www6.in.tum.de/Main/ResearchAgast).
261  *
262  * \author Stefan Holzer
263  * \ingroup keypoints
264  */
265  class PCL_EXPORTS AgastDetector7_12s : public AbstractAgastDetector
266  {
267  public:
268  using Ptr = boost::shared_ptr<AgastDetector7_12s>;
269  using ConstPtr = boost::shared_ptr<const AgastDetector7_12s>;
270 
271  /** \brief Constructor.
272  * \param[in] width the width of the image to process
273  * \param[in] height the height of the image to process
274  * \param[in] threshold the corner detection threshold
275  * \param[in] bmax the max image value (default: 255)
276  */
277  AgastDetector7_12s (const size_t width,
278  const size_t height,
279  const double threshold,
280  const double bmax = 255)
281  : AbstractAgastDetector (width, height, threshold, bmax)
282  {
283  initPattern ();
284  }
285 
286  /** \brief Destructor. */
288 
289  /** \brief Computes corner score.
290  * \param im
291  */
292  int
293  computeCornerScore (const unsigned char* im) const override;
294 
295  /** \brief Computes corner score.
296  * \param im
297  */
298  int
299  computeCornerScore (const float* im) const override;
300 
301  /** \brief Detects points of interest (i.e., keypoints) in the given image
302  * \param[in] im the image to detect keypoints in
303  * \param[out] corners_all the resultant set of keypoints detected
304  */
305  void
306  detect (const unsigned char* im, std::vector<pcl::PointUV, Eigen::aligned_allocator<pcl::PointUV> > &corners_all) const override;
307 
308  /** \brief Detects points of interest (i.e., keypoints) in the given image
309  * \param[in] im the image to detect keypoints in
310  * \param[out] corners_all the resultant set of keypoints detected
311  */
312  void
313  detect (const float* im, std::vector<pcl::PointUV, Eigen::aligned_allocator<pcl::PointUV> > &corners_all) const override;
314 
315  protected:
316  /** \brief Initializes the sample pattern. */
317  void
318  initPattern () override;
319 
320  private:
321  /** \brief Border width. */
322  static const int border_width_ = 2;
323 
324  // offsets defining the sample pattern
325  std::array<int_fast16_t, 12> offset_;
326  };
327 
328  /** \brief Detector class for AGAST corner point detector (5_8).
329  *
330  * Adapted from the C++ implementation of Elmar Mair
331  * (http://www6.in.tum.de/Main/ResearchAgast).
332  *
333  * \author Stefan Holzer
334  * \ingroup keypoints
335  */
336  class PCL_EXPORTS AgastDetector5_8 : public AbstractAgastDetector
337  {
338  public:
339  using Ptr = boost::shared_ptr<AgastDetector5_8>;
340  using ConstPtr = boost::shared_ptr<const AgastDetector5_8>;
341 
342  /** \brief Constructor.
343  * \param[in] width the width of the image to process
344  * \param[in] height the height of the image to process
345  * \param[in] threshold the corner detection threshold
346  * \param[in] bmax the max image value (default: 255)
347  */
348  AgastDetector5_8 (const size_t width,
349  const size_t height,
350  const double threshold,
351  const double bmax = 255)
352  : AbstractAgastDetector (width, height, threshold, bmax)
353  {
354  initPattern ();
355  }
356 
357  /** \brief Destructor. */
359 
360  /** \brief Computes corner score.
361  * \param im
362  */
363  int
364  computeCornerScore (const unsigned char* im) const override;
365 
366  /** \brief Computes corner score.
367  * \param im
368  */
369  int
370  computeCornerScore (const float* im) const override;
371 
372  /** \brief Detects points of interest (i.e., keypoints) in the given image
373  * \param[in] im the image to detect keypoints in
374  * \param[out] corners_all the resultant set of keypoints detected
375  */
376  void
377  detect (const unsigned char* im, std::vector<pcl::PointUV, Eigen::aligned_allocator<pcl::PointUV> > &corners_all) const override;
378 
379  /** \brief Detects points of interest (i.e., keypoints) in the given image
380  * \param[in] im the image to detect keypoints in
381  * \param[out] corners_all the resultant set of keypoints detected
382  */
383  void
384  detect (const float* im, std::vector<pcl::PointUV, Eigen::aligned_allocator<pcl::PointUV> > &corners_all) const override;
385 
386  protected:
387  /** \brief Initializes the sample pattern. */
388  void
389  initPattern () override;
390 
391  private:
392  /** \brief Border width. */
393  static const int border_width_ = 1;
394 
395  // offsets defining the sample pattern
396  std::array<int_fast16_t, 8> offset_;
397  };
398 
399  /** \brief Detector class for AGAST corner point detector (OAST 9_16).
400  *
401  * Adapted from the C++ implementation of Elmar Mair
402  * (http://www6.in.tum.de/Main/ResearchAgast).
403  *
404  * \author Stefan Holzer
405  * \ingroup keypoints
406  */
407  class PCL_EXPORTS OastDetector9_16 : public AbstractAgastDetector
408  {
409  public:
410  using Ptr = boost::shared_ptr<OastDetector9_16>;
411  using ConstPtr = boost::shared_ptr<const OastDetector9_16>;
412 
413  /** \brief Constructor.
414  * \param[in] width the width of the image to process
415  * \param[in] height the height of the image to process
416  * \param[in] threshold the corner detection threshold
417  * \param[in] bmax the max image value (default: 255)
418  */
419  OastDetector9_16 (const size_t width,
420  const size_t height,
421  const double threshold,
422  const double bmax = 255)
423  : AbstractAgastDetector (width, height, threshold, bmax)
424  {
425  initPattern ();
426  }
427 
428  /** \brief Destructor. */
430 
431  /** \brief Computes corner score.
432  * \param im
433  */
434  int
435  computeCornerScore (const unsigned char* im) const override;
436 
437  /** \brief Computes corner score.
438  * \param im
439  */
440  int
441  computeCornerScore (const float* im) const override;
442 
443  /** \brief Detects points of interest (i.e., keypoints) in the given image
444  * \param[in] im the image to detect keypoints in
445  * \param[out] corners_all the resultant set of keypoints detected
446  */
447  void
448  detect (const unsigned char* im, std::vector<pcl::PointUV, Eigen::aligned_allocator<pcl::PointUV> > &corners_all) const override;
449 
450  /** \brief Detects points of interest (i.e., keypoints) in the given image
451  * \param[in] im the image to detect keypoints in
452  * \param[out] corners_all the resultant set of keypoints detected
453  */
454  void
455  detect (const float* im, std::vector<pcl::PointUV, Eigen::aligned_allocator<pcl::PointUV> > &corners_all) const override;
456 
457  protected:
458  /** \brief Initializes the sample pattern. */
459  void
460  initPattern () override;
461 
462  private:
463  /** \brief Border width. */
464  static const int border_width_ = 3;
465 
466  // offsets defining the sample pattern
467  std::array<int_fast16_t, 16> offset_;
468  };
469  } // namespace agast
470  } // namespace keypoints
471 
472  /////////////////////////////////////////////////////////////////////////////////////////
473  /////////////////////////////////////////////////////////////////////////////////////////
474  /////////////////////////////////////////////////////////////////////////////////////////
475  namespace keypoints
476  {
477  namespace internal
478  {
479  /////////////////////////////////////////////////////////////////////////////////////
480  template <typename Out>
482  {
484  const std::vector<unsigned char> &image_data,
485  const pcl::PointCloud<pcl::PointUV> &tmp_cloud,
487  pcl::PointCloud<Out> &output)
488  {
489  pcl::PointCloud<pcl::PointUV> output_temp;
490  detector->applyNonMaxSuppression (image_data, tmp_cloud, output_temp);
491  pcl::copyPointCloud<pcl::PointUV, Out> (output_temp, output);
492  }
493  };
494 
495  /////////////////////////////////////////////////////////////////////////////////////
496  template <>
498  {
500  const std::vector<unsigned char> &image_data,
501  const pcl::PointCloud<pcl::PointUV> &tmp_cloud,
504  {
505  detector->applyNonMaxSuppression (image_data, tmp_cloud, output);
506  }
507  };
508  /////////////////////////////////////////////////////////////////////////////////////
509  template <typename Out>
511  {
513  const std::vector<unsigned char> &image_data,
515  pcl::PointCloud<Out> &output)
516  {
517  pcl::PointCloud<pcl::PointUV> output_temp;
518  detector->detectKeypoints (image_data, output_temp);
519  pcl::copyPointCloud<pcl::PointUV, Out> (output_temp, output);
520  }
521  };
522 
523  /////////////////////////////////////////////////////////////////////////////////////
524  template <>
526  {
528  const std::vector<unsigned char> &image_data,
531  {
532  detector->detectKeypoints (image_data, output);
533  }
534  };
535  } // namespace agast
536  } // namespace keypoints
537 
538  /////////////////////////////////////////////////////////////////////////////////////////
539  /////////////////////////////////////////////////////////////////////////////////////////
540  /////////////////////////////////////////////////////////////////////////////////////////
541  /** \brief Detects 2D AGAST corner points. Based on the original work and
542  * paper reference by
543  *
544  * \par
545  * Elmar Mair, Gregory D. Hager, Darius Burschka, Michael Suppa, and Gerhard Hirzinger.
546  * Adaptive and generic corner detection based on the accelerated segment test.
547  * In Proceedings of the European Conference on Computer Vision (ECCV'10), September 2010.
548  *
549  * \note This is an abstract base class. All children must implement a detectKeypoints method, based on the type of AGAST keypoint to be used.
550  *
551  * \author Stefan Holzer, Radu B. Rusu
552  * \ingroup keypoints
553  */
554  template <typename PointInT, typename PointOutT, typename IntensityT = pcl::common::IntensityFieldAccessor<PointInT> >
555  class AgastKeypoint2DBase : public Keypoint<PointInT, PointOutT>
556  {
557  public:
562 
564 
569 
570  /** \brief Constructor */
572  : threshold_ (10)
573  , apply_non_max_suppression_ (true)
574  , bmax_ (255)
575  , nr_max_keypoints_ (std::numeric_limits<unsigned int>::max ())
576  {
577  k_ = 1;
578  }
579 
580  /** \brief Destructor. */
582  {
583  }
584 
585  /** \brief Sets the threshold for corner detection.
586  * \param[in] threshold the threshold used for corner detection.
587  */
588  inline void
589  setThreshold (const double threshold)
590  {
591  threshold_ = threshold;
592  }
593 
594  /** \brief Get the threshold for corner detection, as set by the user. */
595  inline double
597  {
598  return (threshold_);
599  }
600 
601  /** \brief Sets the maximum number of keypoints to return. The
602  * estimated keypoints are sorted by their internal score.
603  * \param[in] nr_max_keypoints set the maximum number of keypoints to return
604  */
605  inline void
606  setMaxKeypoints (const unsigned int nr_max_keypoints)
607  {
608  nr_max_keypoints_ = nr_max_keypoints;
609  }
610 
611  /** \brief Get the maximum number of keypoints to return, as set by the user. */
612  inline unsigned int
614  {
615  return (nr_max_keypoints_);
616  }
617 
618  /** \brief Sets the max image data value (affects how many iterations AGAST does)
619  * \param[in] bmax the max image data value
620  */
621  inline void
622  setMaxDataValue (const double bmax)
623  {
624  bmax_ = bmax;
625  }
626 
627  /** \brief Get the bmax image value, as set by the user. */
628  inline double
630  {
631  return (bmax_);
632  }
633 
634  /** \brief Sets whether non-max-suppression is applied or not.
635  * \param[in] enabled determines whether non-max-suppression is enabled.
636  */
637  inline void
638  setNonMaxSuppression (const bool enabled)
639  {
640  apply_non_max_suppression_ = enabled;
641  }
642 
643  /** \brief Returns whether non-max-suppression is applied or not. */
644  inline bool
646  {
647  return (apply_non_max_suppression_);
648  }
649 
650  inline void
652  {
653  detector_ = detector;
654  }
655 
656  inline AgastDetectorPtr
658  {
659  return (detector_);
660  }
661  protected:
662 
663  /** \brief Initializes everything and checks whether input data is fine. */
664  bool
665  initCompute () override;
666 
667  /** \brief Detects the keypoints.
668  * \param[out] output the resultant keypoints
669  */
670  void
671  detectKeypoints (PointCloudOut &output) override = 0;
672 
673  /** \brief Intensity field accessor. */
674  IntensityT intensity_;
675 
676  /** \brief Threshold for corner detection. */
677  double threshold_;
678 
679  /** \brief Determines whether non-max-suppression is activated. */
681 
682  /** \brief Max image value. */
683  double bmax_;
684 
685  /** \brief The Agast detector to use. */
687 
688  /** \brief The maximum number of keypoints to return. */
689  unsigned int nr_max_keypoints_;
690  };
691 
692  /** \brief Detects 2D AGAST corner points. Based on the original work and
693  * paper reference by
694  *
695  * \par
696  * Elmar Mair, Gregory D. Hager, Darius Burschka, Michael Suppa, and Gerhard Hirzinger.
697  * Adaptive and generic corner detection based on the accelerated segment test.
698  * In Proceedings of the European Conference on Computer Vision (ECCV'10), September 2010.
699  *
700  * Code example:
701  *
702  * \code
703  * pcl::PointCloud<pcl::PointXYZRGBA> cloud;
704  * pcl::AgastKeypoint2D<pcl::PointXYZRGBA> agast;
705  * agast.setThreshold (30);
706  * agast.setInputCloud (cloud);
707  *
708  * PointCloud<pcl::PointUV> keypoints;
709  * agast.compute (keypoints);
710  * \endcode
711  *
712  * \note The AGAST keypoint type used is 7_12s.
713  *
714  * \author Stefan Holzer, Radu B. Rusu
715  * \ingroup keypoints
716  */
717  template <typename PointInT, typename PointOutT = pcl::PointUV>
718  class AgastKeypoint2D : public AgastKeypoint2DBase<PointInT, PointOutT, pcl::common::IntensityFieldAccessor<PointInT> >
719  {
720  public:
722 
733 
734  /** \brief Constructor */
736  {
737  name_ = "AgastKeypoint2D";
738  }
739 
740  /** \brief Destructor. */
742  {
743  }
744 
745  protected:
746  /** \brief Detects the keypoints.
747  * \param[out] output the resultant keypoints
748  */
749  void
750  detectKeypoints (PointCloudOut &output) override;
751  };
752 
753  /** \brief Detects 2D AGAST corner points. Based on the original work and
754  * paper reference by
755  *
756  * \par
757  * Elmar Mair, Gregory D. Hager, Darius Burschka, Michael Suppa, and Gerhard Hirzinger.
758  * Adaptive and generic corner detection based on the accelerated segment test.
759  * In Proceedings of the European Conference on Computer Vision (ECCV'10), September 2010.
760  *
761  * Code example:
762  *
763  * \code
764  * pcl::PointCloud<pcl::PointXYZRGBA> cloud;
765  * pcl::AgastKeypoint2D<pcl::PointXYZRGBA> agast;
766  * agast.setThreshold (30);
767  * agast.setInputCloud (cloud);
768  *
769  * PointCloud<pcl::PointUV> keypoints;
770  * agast.compute (keypoints);
771  * \endcode
772  *
773  * \note This is a specialized version for PointXYZ clouds, and operates on depth (z) as float. The output keypoints are of the PointXY type.
774  * \note The AGAST keypoint type used is 7_12s.
775  *
776  * \author Stefan Holzer, Radu B. Rusu
777  * \ingroup keypoints
778  */
779  template <>
781  : public AgastKeypoint2DBase<pcl::PointXYZ, pcl::PointUV, pcl::common::IntensityFieldAccessor<pcl::PointXYZ> >
782  {
783  public:
784  /** \brief Constructor */
786  {
787  name_ = "AgastKeypoint2D";
788  bmax_ = 4; // max data value for an OpenNI camera
789  }
790 
791  /** \brief Destructor. */
793  {
794  }
795 
796  protected:
797  /** \brief Detects the keypoints.
798  * \param[out] output the resultant keypoints
799  */
800  void
801  detectKeypoints (pcl::PointCloud<pcl::PointUV> &output) override;
802  };
803 
804 }
805 
806 #include <pcl/keypoints/impl/agast_2d.hpp>
size_t width_
Width of the image to process.
Definition: agast_2d.h:243
AgastDetectorPtr getAgastDetector()
Definition: agast_2d.h:657
void setAgastDetector(const AgastDetectorPtr &detector)
Definition: agast_2d.h:651
boost::shared_ptr< AbstractAgastDetector > Ptr
Definition: agast_2d.h:66
AgastDetector(const std::vector< unsigned char > &image_data, const pcl::keypoints::agast::AbstractAgastDetector::Ptr &detector, pcl::PointCloud< Out > &output)
Definition: agast_2d.h:512
double bmax_
Max image value.
Definition: agast_2d.h:683
double getThreshold()
Get the threshold for corner detection, as set by the user.
Definition: agast_2d.h:148
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:499
Detects 2D AGAST corner points.
Definition: agast_2d.h:718
size_t height_
Height of the image to process.
Definition: agast_2d.h:245
This file defines compatibility wrappers for low level I/O functions.
Definition: convolution.h:45
double getMaxDataValue()
Get the bmax image value, as set by the user.
Definition: agast_2d.h:629
OastDetector9_16(const size_t width, const size_t height, const double threshold, const double bmax=255)
Constructor.
Definition: agast_2d.h:419
Detector class for AGAST corner point detector (7_12s).
Definition: agast_2d.h:265
virtual ~AbstractAgastDetector()
Destructor.
Definition: agast_2d.h:87
Detects 2D AGAST corner points.
Definition: agast_2d.h:555
AgastKeypoint2D()
Constructor.
Definition: agast_2d.h:735
typename Keypoint< PointInT, PointOutT >::PointCloudOut PointCloudOut
Definition: agast_2d.h:721
boost::shared_ptr< const AbstractAgastDetector > ConstPtr
Definition: agast_2d.h:67
AgastDetector7_12s(const size_t width, const size_t height, const double threshold, const double bmax=255)
Constructor.
Definition: agast_2d.h:277
AgastDetectorPtr detector_
The Agast detector to use.
Definition: agast_2d.h:686
bool getNonMaxSuppression()
Returns whether non-max-suppression is applied or not.
Definition: agast_2d.h:645
void setMaxDataValue(const double bmax)
Sets the max image data value (affects how many iterations AGAST does)
Definition: agast_2d.h:622
unsigned int getMaxKeypoints()
Get the maximum number of keypoints to return, as set by the user.
Definition: agast_2d.h:165
double threshold_
Threshold for corner detection.
Definition: agast_2d.h:677
AgastDetector5_8(const size_t width, const size_t height, const double threshold, const double bmax=255)
Constructor.
Definition: agast_2d.h:348
Structure holding an index and the associated keypoint score.
Definition: agast_2d.h:188
Keypoint represents the base class for key points.
Definition: keypoint.h:48
void setMaxKeypoints(const unsigned int nr_max_keypoints)
Sets the maximum number of keypoints to return.
Definition: agast_2d.h:158
A 2D point structure representing pixel image coordinates.
typename PointCloudIn::ConstPtr PointCloudInConstPtr
Definition: keypoint.h:68
A point structure representing Euclidean xyz coordinates.
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:483
~AgastKeypoint2DBase()
Destructor.
Definition: agast_2d.h:581
~AgastKeypoint2D()
Destructor.
Definition: agast_2d.h:741
Detector class for AGAST corner point detector (OAST 9_16).
Definition: agast_2d.h:407
void setThreshold(const double threshold)
Sets the threshold for corner detection.
Definition: agast_2d.h:589
unsigned int nr_max_keypoints_
The maximum number of keypoints to return.
Definition: agast_2d.h:689
bool apply_non_max_suppression_
Determines whether non-max-suppression is activated.
Definition: agast_2d.h:680
PointCloud represents the base class in PCL for storing collections of 3D points. ...
AgastDetector(const std::vector< unsigned char > &image_data, const pcl::keypoints::agast::AbstractAgastDetector::Ptr &detector, pcl::PointCloud< pcl::PointUV > &output)
Definition: agast_2d.h:527
unsigned int nr_max_keypoints_
The maximum number of keypoints to return.
Definition: agast_2d.h:251
unsigned int getMaxKeypoints()
Get the maximum number of keypoints to return, as set by the user.
Definition: agast_2d.h:613
double getThreshold()
Get the threshold for corner detection, as set by the user.
Definition: agast_2d.h:596
boost::shared_ptr< const PointCloud< pcl::PointXYZ > > ConstPtr
Definition: point_cloud.h:430
Detector class for AGAST corner point detector (5_8).
Definition: agast_2d.h:336
Abstract detector class for AGAST corner point detectors.
Definition: agast_2d.h:63
void setNonMaxSuppression(const bool enabled)
Sets whether non-max-suppression is applied or not.
Definition: agast_2d.h:638
AgastKeypoint2DBase()
Constructor.
Definition: agast_2d.h:571
double threshold_
Threshold for corner detection.
Definition: agast_2d.h:248
AbstractAgastDetector(const size_t width, const size_t height, const double threshold, const double bmax)
Constructor.
Definition: agast_2d.h:75
void setThreshold(const double threshold)
Sets the threshold for corner detection.
Definition: agast_2d.h:141
IntensityT intensity_
Intensity field accessor.
Definition: agast_2d.h:674
void setMaxKeypoints(const unsigned int nr_max_keypoints)
Sets the maximum number of keypoints to return.
Definition: agast_2d.h:606