40 #ifndef PCL_KEYPOINTS_BRISK_KEYPOINT_2D_H_ 41 #define PCL_KEYPOINTS_BRISK_KEYPOINT_2D_H_ 43 #include <pcl/keypoints/agast_2d.h> 71 template <
typename Po
intInT,
typename Po
intOutT = pcl::Po
intWithScale,
typename IntensityT = pcl::common::IntensityFieldAccessor<Po
intInT> >
75 typedef boost::shared_ptr<BriskKeypoint2D<PointInT, PointOutT, IntensityT> >
Ptr;
76 typedef boost::shared_ptr<const BriskKeypoint2D<PointInT, PointOutT, IntensityT> >
ConstPtr;
90 : threshold_ (threshold)
92 , remove_invalid_3D_keypoints_ (false)
95 name_ =
"BriskKeypoint2D";
109 threshold_ = threshold;
143 remove_invalid_3D_keypoints_ = remove;
152 return (remove_invalid_3D_keypoints_);
164 pt.x = pt.y = pt.z = 0;
166 const PointInT &p1 = (*cloud)(u, v);
167 const PointInT &p2 = (*cloud)(u+1, v);
168 const PointInT &p3 = (*cloud)(u, v+1);
169 const PointInT &p4 = (*cloud)(u+1, v+1);
171 float fx = x - float (u), fy = y - float (v);
172 float fx1 = 1.0f - fx, fy1 = 1.0f - fy;
174 float w1 = fx1 * fy1, w2 = fx * fy1, w3 = fx1 * fy, w4 = fx * fy;
207 pt.x = pt.y = pt.z = std::numeric_limits<float>::quiet_NaN ();
210 weight = 1.0f / weight;
211 pt.x *= weight; pt.y *= weight; pt.z *= weight;
226 IntensityT intensity_;
236 bool remove_invalid_3D_keypoints_;
253 static const int HALFSAMPLE = 0;
254 static const int TWOTHIRDSAMPLE = 1;
264 Layer (
const std::vector<unsigned char>& img,
265 int width,
int height,
266 float scale = 1.0f,
float offset = 0.0f);
279 getAgastPoints (uint8_t threshold, std::vector<
pcl::PointUV, Eigen::aligned_allocator<pcl::PointUV> > &keypoints);
288 getAgastScore (
int x,
int y, uint8_t threshold);
295 getAgastScore_5_8 (
int x,
int y, uint8_t threshold);
303 getAgastScore (
float xf,
float yf, uint8_t threshold,
float scale = 1.0f);
314 getValue (
const std::vector<unsigned char>& mat,
315 int width,
int height,
float xf,
float yf,
float scale);
318 const std::vector<unsigned char>&
335 return (img_height_);
353 inline const std::vector<unsigned char>&
362 halfsample (
const std::vector<unsigned char>& srcimg,
363 int srcwidth,
int srcheight,
364 std::vector<unsigned char>& dstimg,
365 int dstwidth,
int dstheight);
369 twothirdsample (
const std::vector<unsigned char>& srcimg,
370 int srcwidth,
int srcheight,
371 std::vector<unsigned char>& dstimg,
372 int dstwidth,
int dstheight);
375 std::vector<unsigned char> img_;
380 std::vector<unsigned char> scores_;
387 boost::shared_ptr<pcl::keypoints::agast::OastDetector9_16> oast_detector_;
388 boost::shared_ptr<pcl::keypoints::agast::AgastDetector5_8> agast_detector_5_8_;
407 constructPyramid (
const std::vector<unsigned char>& image,
408 int width,
int height);
415 getKeypoints (
const int threshold,
416 std::vector<
pcl::PointWithScale, Eigen::aligned_allocator<pcl::PointWithScale> > &keypoints);
421 isMax2D (
const uint8_t layer,
const int x_layer,
const int y_layer);
425 refine1D (
const float s_05,
const float s0,
const float s05,
float& max);
429 refine1D_1 (
const float s_05,
const float s0,
const float s05,
float& max);
433 refine1D_2 (
const float s_05,
const float s0,
const float s05,
float& max);
437 subpixel2D (
const int s_0_0,
const int s_0_1,
const int s_0_2,
438 const int s_1_0,
const int s_1_1,
const int s_1_2,
439 const int s_2_0,
const int s_2_1,
const int s_2_2,
440 float& delta_x,
float& delta_y);
444 refine3D (
const uint8_t layer,
445 const int x_layer,
const int y_layer,
446 float& x,
float& y,
float& scale,
bool& ismax);
450 getScoreAbove (
const uint8_t layer,
const int x_layer,
const int y_layer);
453 getScoreBelow (
const uint8_t layer,
const int x_layer,
const int y_layer);
457 getScoreMaxAbove (
const uint8_t layer,
458 const int x_layer,
const int y_layer,
459 const int threshold,
bool& ismax,
460 float& dx,
float& dy);
463 getScoreMaxBelow (
const uint8_t layer,
464 const int x_layer,
const int y_layer,
465 const int threshold,
bool& ismax,
466 float& dx,
float& dy);
470 std::vector<pcl::keypoints::brisk::Layer>
pyramid_;
485 #include <pcl/keypoints/impl/brisk_2d.hpp> bool isFinite(const PointT &pt)
Tests if the 3D components of a point are all finite param[in] pt point to be tested return true if f...
BRISK Scale Space helper.
A layer in the BRISK detector pyramid.
std::vector< pcl::keypoints::brisk::Layer > pyramid_
std::string name_
The key point detection method's name.
This file defines compatibility wrappers for low level I/O functions.
void bilinearInterpolation(const PointCloudInConstPtr &cloud, float x, float y, PointOutT &pt)
Keypoint< PointInT, PointOutT >::KdTree KdTree
virtual ~BriskKeypoint2D()
Destructor.
size_t getThreshold()
Get the threshold for corner detection, as set by the user.
int getImageHeight() const
Get the height of the image used.
Keypoint represents the base class for key points.
A 2D point structure representing pixel image coordinates.
PointCloudIn::ConstPtr PointCloudInConstPtr
int k_
The number of K nearest neighbors to use for each point.
bool initCompute()
Initializes everything and checks whether input data is fine.
float getOffset() const
Get the offset used.
boost::shared_ptr< const PointCloud< PointInT > > ConstPtr
float getScale() const
Get the scale used.
void detectKeypoints(PointCloudOut &output)
Detects the keypoints.
Keypoint< PointInT, PointOutT >::PointCloudOut PointCloudOut
int getOctaves()
Returns the number of octaves used.
boost::shared_ptr< const BriskKeypoint2D< PointInT, PointOutT, IntensityT > > ConstPtr
const std::vector< unsigned char > & getScores() const
Get the scores obtained.
bool getRemoveInvalid3DKeypoints()
Specify whether the keypoints that do not have a valid 3D position are kept (false) or removed (true)...
const std::vector< unsigned char > & getImage() const
Get the image used.
Keypoint< PointInT, PointOutT >::PointCloudIn PointCloudIn
void setRemoveInvalid3DKeypoints(bool remove)
Specify whether we should do a 2nd pass through the list of keypoints found, and remove the ones that...
Detects BRISK interest points based on the original code and paper reference by.
BriskKeypoint2D(int octaves=4, int threshold=60)
Constructor.
A point structure representing a 3-D position and scale.
boost::shared_ptr< BriskKeypoint2D< PointInT, PointOutT, IntensityT > > Ptr
void setOctaves(const int octaves)
Set the number of octaves to use.
void setThreshold(const int threshold)
Sets the threshold for corner detection.
int getImageWidth() const
Get the width of the image used.