43 #include <pcl/point_cloud.h>
45 #include <pcl/keypoints/keypoint.h>
46 #include <pcl/common/intensity.h>
47 #include <pcl/common/io.h>
67 using Ptr = shared_ptr<AbstractAgastDetector>;
68 using ConstPtr = shared_ptr<const AbstractAgastDetector>;
77 const std::size_t height,
78 const double threshold,
82 , threshold_ (threshold)
83 , nr_max_keypoints_ (std::numeric_limits<unsigned int>::max ())
144 threshold_ = threshold;
161 nr_max_keypoints_ = nr_max_keypoints;
168 return (nr_max_keypoints_);
177 std::vector<
pcl::PointUV, Eigen::aligned_allocator<pcl::PointUV> > &corners_all)
const = 0;
184 std::vector<
pcl::PointUV, Eigen::aligned_allocator<pcl::PointUV> > &)
const = 0;
220 const std::vector<ScoreIndex>& scores,
230 const std::vector<
pcl::PointUV, Eigen::aligned_allocator<pcl::PointUV> > & corners_all,
231 std::vector<ScoreIndex> & scores)
const;
240 const std::vector<
pcl::PointUV, Eigen::aligned_allocator<pcl::PointUV> > & corners_all,
241 std::vector<ScoreIndex> & scores)
const;
269 using Ptr = shared_ptr<AgastDetector7_12s>;
270 using ConstPtr = shared_ptr<const AgastDetector7_12s>;
279 const std::size_t height,
280 const double threshold,
281 const double bmax = 255)
307 detect (
const unsigned char* im, std::vector<
pcl::PointUV, Eigen::aligned_allocator<pcl::PointUV> > &corners_all)
const override;
314 detect (
const float* im, std::vector<
pcl::PointUV, Eigen::aligned_allocator<pcl::PointUV> > &corners_all)
const override;
323 static const int border_width_ = 2;
326 std::array<std::int_fast16_t, 12> offset_;
340 using Ptr = shared_ptr<AgastDetector5_8>;
341 using ConstPtr = shared_ptr<const AgastDetector5_8>;
350 const std::size_t height,
351 const double threshold,
352 const double bmax = 255)
378 detect (
const unsigned char* im, std::vector<
pcl::PointUV, Eigen::aligned_allocator<pcl::PointUV> > &corners_all)
const override;
385 detect (
const float* im, std::vector<
pcl::PointUV, Eigen::aligned_allocator<pcl::PointUV> > &corners_all)
const override;
394 static const int border_width_ = 1;
397 std::array<std::int_fast16_t, 8> offset_;
411 using Ptr = shared_ptr<OastDetector9_16>;
412 using ConstPtr = shared_ptr<const OastDetector9_16>;
421 const std::size_t height,
422 const double threshold,
423 const double bmax = 255)
449 detect (
const unsigned char* im, std::vector<
pcl::PointUV, Eigen::aligned_allocator<pcl::PointUV> > &corners_all)
const override;
456 detect (
const float* im, std::vector<
pcl::PointUV, Eigen::aligned_allocator<pcl::PointUV> > &corners_all)
const override;
465 static const int border_width_ = 3;
468 std::array<std::int_fast16_t, 16> offset_;
481 template <
typename Out>
485 const std::vector<unsigned char> &image_data,
491 detector->applyNonMaxSuppression (image_data, tmp_cloud, output_temp);
501 const std::vector<unsigned char> &image_data,
506 detector->applyNonMaxSuppression (image_data, tmp_cloud, output);
510 template <
typename Out>
514 const std::vector<unsigned char> &image_data,
519 detector->detectKeypoints (image_data, output_temp);
529 const std::vector<unsigned char> &image_data,
533 detector->detectKeypoints (image_data, output);
555 template <
typename Po
intInT,
typename Po
intOutT,
typename IntensityT = pcl::common::IntensityFieldAccessor<Po
intInT> >
714 template <
typename Po
intInT,
typename Po
intOutT = pcl::Po
intUV>
734 name_ =
"AgastKeypoint2D";
776 :
public AgastKeypoint2DBase<pcl::PointXYZ, pcl::PointUV, pcl::common::IntensityFieldAccessor<pcl::PointXYZ> >
782 name_ =
"AgastKeypoint2D";
799 #include <pcl/keypoints/impl/agast_2d.hpp>
void detectKeypoints(pcl::PointCloud< pcl::PointUV > &output) override
Detects the keypoints.
~AgastKeypoint2D() override=default
Destructor.
AgastKeypoint2D()
Constructor.
Detects 2D AGAST corner points.
AgastDetectorPtr getAgastDetector()
typename Keypoint< PointInT, PointOutT >::PointCloudOut PointCloudOut
double getThreshold()
Get the threshold for corner detection, as set by the user.
typename PointCloudIn::ConstPtr PointCloudInConstPtr
void setMaxDataValue(const double bmax)
Sets the max image data value (affects how many iterations AGAST does)
double threshold_
Threshold for corner detection.
typename Keypoint< PointInT, PointOutT >::KdTree KdTree
void detectKeypoints(PointCloudOut &output) override=0
Detects the keypoints.
IntensityT intensity_
Intensity field accessor.
void setMaxKeypoints(const unsigned int nr_max_keypoints)
Sets the maximum number of keypoints to return.
double bmax_
Max image value.
double getMaxDataValue()
Get the bmax image value, as set by the user.
void setThreshold(const double threshold)
Sets the threshold for corner detection.
bool initCompute() override
Initializes everything and checks whether input data is fine.
~AgastKeypoint2DBase() override=default
Destructor.
void setAgastDetector(const AgastDetectorPtr &detector)
AgastDetectorPtr detector_
The Agast detector to use.
unsigned int nr_max_keypoints_
The maximum number of keypoints to return.
bool getNonMaxSuppression()
Returns whether non-max-suppression is applied or not.
AgastKeypoint2DBase()
Constructor.
bool apply_non_max_suppression_
Determines whether non-max-suppression is activated.
typename Keypoint< PointInT, PointOutT >::PointCloudIn PointCloudIn
void setNonMaxSuppression(const bool enabled)
Sets whether non-max-suppression is applied or not.
pcl::keypoints::agast::AbstractAgastDetector::Ptr AgastDetectorPtr
unsigned int getMaxKeypoints()
Get the maximum number of keypoints to return, as set by the user.
Detects 2D AGAST corner points.
AgastKeypoint2D()
Constructor.
typename Keypoint< PointInT, PointOutT >::PointCloudOut PointCloudOut
void detectKeypoints(PointCloudOut &output) override
Detects the keypoints.
~AgastKeypoint2D() override=default
Destructor.
Keypoint represents the base class for key points.
int k_
The number of K nearest neighbors to use for each point.
std::string name_
The key point detection method's name.
Abstract detector class for AGAST corner point detectors.
AbstractAgastDetector(const std::size_t width, const std::size_t height, const double threshold, const double bmax)
Constructor.
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
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.
void setMaxKeypoints(const unsigned int nr_max_keypoints)
Sets the maximum number of keypoints to return.
double threshold_
Threshold for corner detection.
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.
shared_ptr< const AbstractAgastDetector > ConstPtr
void setThreshold(const double threshold)
Sets the threshold for corner detection.
double getThreshold()
Get the threshold for corner detection, as set by the user.
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.
virtual ~AbstractAgastDetector()=default
Destructor.
std::size_t height_
Height of the image to process.
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.
virtual int computeCornerScore(const unsigned char *im) const =0
Computes corner score.
std::size_t width_
Width of the image to process.
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.
double bmax_
Max image value.
Detector class for AGAST corner point detector (5_8).
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.
~AgastDetector5_8() override=default
Destructor.
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.
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.
Detector class for AGAST corner point detector (7_12s).
~AgastDetector7_12s() override=default
Destructor.
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.
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).
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.
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.
~OastDetector9_16() override=default
Destructor.
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.
A 2D point structure representing pixel image coordinates.
A point structure representing Euclidean xyz coordinates.
Structure holding an index and the associated keypoint score.
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)
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)
AgastDetector(const std::vector< unsigned char > &image_data, const pcl::keypoints::agast::AbstractAgastDetector::Ptr &detector, pcl::PointCloud< pcl::PointUV > &output)
AgastDetector(const std::vector< unsigned char > &image_data, const pcl::keypoints::agast::AbstractAgastDetector::Ptr &detector, pcl::PointCloud< Out > &output)