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>