Point Cloud Library (PCL)
1.11.0
|
42 #include <pcl/common/point_tests.h>
43 #include <pcl/keypoints/agast_2d.h>
72 template <
typename Po
intInT,
typename Po
intOutT = pcl::Po
intWithScale,
typename IntensityT = pcl::common::IntensityFieldAccessor<Po
intInT> >
76 using Ptr = shared_ptr<BriskKeypoint2D<PointInT, PointOutT, IntensityT> >;
77 using ConstPtr = shared_ptr<const BriskKeypoint2D<PointInT, PointOutT, IntensityT> >;
91 : threshold_ (threshold)
93 , remove_invalid_3D_keypoints_ (false)
96 name_ =
"BriskKeypoint2D";
110 threshold_ = threshold;
144 remove_invalid_3D_keypoints_ = remove;
153 return (remove_invalid_3D_keypoints_);
165 pt.x = pt.y = pt.z = 0;
167 const PointInT &p1 = (*cloud)(u, v);
168 const PointInT &p2 = (*cloud)(u+1, v);
169 const PointInT &p3 = (*cloud)(u, v+1);
170 const PointInT &p4 = (*cloud)(u+1, v+1);
172 float fx = x - float (u), fy = y - float (v);
173 float fx1 = 1.0f - fx, fy1 = 1.0f - fy;
175 float w1 = fx1 * fy1, w2 = fx * fy1, w3 = fx1 * fy, w4 = fx * fy;
208 pt.x = pt.y = pt.z = std::numeric_limits<float>::quiet_NaN ();
211 weight = 1.0f / weight;
212 pt.x *= weight; pt.y *= weight; pt.z *= weight;
227 IntensityT intensity_;
237 bool remove_invalid_3D_keypoints_;
265 Layer (
const std::vector<unsigned char>& img,
266 int width,
int height,
267 float scale = 1.0f,
float offset = 0.0f);
316 int width,
int height,
float xf,
float yf,
float scale);
319 const std::vector<unsigned char>&
336 return (img_height_);
354 inline const std::vector<unsigned char>&
363 halfsample (
const std::vector<unsigned char>& srcimg,
364 int srcwidth,
int srcheight,
365 std::vector<unsigned char>& dstimg,
366 int dstwidth,
int dstheight);
370 twothirdsample (
const std::vector<unsigned char>& srcimg,
371 int srcwidth,
int srcheight,
372 std::vector<unsigned char>& dstimg,
373 int dstwidth,
int dstheight);
376 std::vector<unsigned char> img_;
381 std::vector<unsigned char> scores_;
409 int width,
int height);
417 std::vector<
pcl::PointWithScale, Eigen::aligned_allocator<pcl::PointWithScale> > &keypoints);
426 refine1D (
const float s_05,
const float s0,
const float s05,
float& max);
430 refine1D_1 (
const float s_05,
const float s0,
const float s05,
float& max);
434 refine1D_2 (
const float s_05,
const float s0,
const float s05,
float& max);
438 subpixel2D (
const int s_0_0,
const int s_0_1,
const int s_0_2,
439 const int s_1_0,
const int s_1_1,
const int s_1_2,
440 const int s_2_0,
const int s_2_1,
const int s_2_2,
441 float& delta_x,
float& delta_y);
446 const int x_layer,
const int y_layer,
447 float& x,
float& y,
float& scale,
bool& ismax);
459 const int x_layer,
const int y_layer,
460 const int threshold,
bool& ismax,
461 float& dx,
float& dy);
465 const int x_layer,
const int y_layer,
466 const int threshold,
bool& ismax,
467 float& dx,
float& dy);
471 std::vector<pcl::keypoints::brisk::Layer>
pyramid_;
486 #include <pcl/keypoints/impl/brisk_2d.hpp>
A 2D point structure representing pixel image coordinates.
typename Keypoint< PointInT, PointOutT >::PointCloudIn PointCloudIn
float getScoreMaxBelow(const std::uint8_t layer, const int x_layer, const int y_layer, const int threshold, bool &ismax, float &dx, float &dy)
Layer(const std::vector< unsigned char > &img, int width, int height, float scale=1.0f, float offset=0.0f)
Constructor.
int getScoreAbove(const std::uint8_t layer, const int x_layer, const int y_layer)
interpolated score access with recalculation when needed
Layer(const Layer &layer, int mode)
Copy constructor for deriving a layer.
typename Keypoint< PointInT, PointOutT >::KdTree KdTree
static const int TWOTHIRDSAMPLE
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...
Detects BRISK interest points based on the original code and paper reference by.
shared_ptr< AgastDetector5_8 > Ptr
ScaleSpace(int octaves=3)
Constructor.
int k_
The number of K nearest neighbors to use for each point.
shared_ptr< const BriskKeypoint2D< PointInT, PointOutT, IntensityT > > ConstPtr
std::size_t getThreshold()
Get the threshold for corner detection, as set by the user.
bool isMax2D(const std::uint8_t layer, const int x_layer, const int y_layer)
Nonmax suppression.
float subpixel2D(const int s_0_0, const int s_0_1, const int s_0_2, const int s_1_0, const int s_1_1, const int s_1_2, const int s_2_0, const int s_2_1, const int s_2_2, float &delta_x, float &delta_y)
2D maximum refinement
int getImageHeight() const
Get the height of the image used.
float refine3D(const std::uint8_t layer, const int x_layer, const int y_layer, float &x, float &y, float &scale, bool &ismax)
3D maximum refinement centered around (x_layer,y_layer)
float getOffset() const
Get the offset used.
void getAgastPoints(std::uint8_t threshold, std::vector< pcl::PointUV, Eigen::aligned_allocator< pcl::PointUV > > &keypoints)
AGAST keypoints without non-max suppression.
std::vector< pcl::keypoints::brisk::Layer > pyramid_
int getScoreBelow(const std::uint8_t layer, const int x_layer, const int y_layer)
typename PointCloudIn::ConstPtr PointCloudInConstPtr
float refine1D(const float s_05, const float s0, const float s05, float &max)
1D (scale axis) refinement: around octave
shared_ptr< OastDetector9_16 > Ptr
~BriskKeypoint2D()
Destructor.
std::uint8_t getAgastScore(int x, int y, std::uint8_t threshold)
Get the AGAST keypoint score for a given pixel using a threshold.
void detectKeypoints(PointCloudOut &output) override
Detects the keypoints.
bool getRemoveInvalid3DKeypoints()
Specify whether the keypoints that do not have a valid 3D position are kept (false) or removed (true)...
A layer in the BRISK detector pyramid.
BriskKeypoint2D(int octaves=4, int threshold=60)
Constructor.
typename Keypoint< PointInT, PointOutT >::PointCloudOut PointCloudOut
std::uint8_t getAgastScore(float xf, float yf, std::uint8_t threshold, float scale=1.0f)
Get the AGAST keypoint score for a given pixel using a threshold.
float getScoreMaxAbove(const std::uint8_t layer, const int x_layer, const int y_layer, const int threshold, bool &ismax, float &dx, float &dy)
return the maximum of score patches above or below
void setThreshold(const int threshold)
Sets the threshold for corner detection.
const std::vector< unsigned char > & getImage() const
Get the image used.
float refine1D_1(const float s_05, const float s0, const float s05, float &max)
1D (scale axis) refinement: around intra
void constructPyramid(const std::vector< unsigned char > &image, int width, int height)
Construct the image pyramids.
BRISK Scale Space helper.
void bilinearInterpolation(const PointCloudInConstPtr &cloud, float x, float y, PointOutT &pt)
std::string name_
The key point detection method's name.
int getOctaves()
Returns the number of octaves used.
void setOctaves(const int octaves)
Set the number of octaves to use.
void setRemoveInvalid3DKeypoints(bool remove)
Specify whether we should do a 2nd pass through the list of keypoints found, and remove the ones that...
A point structure representing a 3-D position and scale.
int getImageWidth() const
Get the width of the image used.
std::uint8_t getAgastScore_5_8(int x, int y, std::uint8_t threshold)
Get the AGAST keypoint score for a given pixel using a threshold.
bool initCompute() override
Initializes everything and checks whether input data is fine.
void getKeypoints(const int threshold, std::vector< pcl::PointWithScale, Eigen::aligned_allocator< pcl::PointWithScale > > &keypoints)
Get the keypoints for the associated image and threshold.
static const int HALFSAMPLE
shared_ptr< BriskKeypoint2D< PointInT, PointOutT, IntensityT > > Ptr
std::uint8_t safe_threshold_
Keypoint represents the base class for key points.
std::uint8_t getValue(const std::vector< unsigned char > &mat, int width, int height, float xf, float yf, float scale)
Access gray values (smoothed/interpolated)
float refine1D_2(const float s_05, const float s0, const float s05, float &max)
1D (scale axis) refinement: around octave 0 only
float getScale() const
Get the scale used.
const std::vector< unsigned char > & getScores() const
Get the scores obtained.