3 #include <opencv2/core/core.hpp> 4 #include <opencv2/imgproc/imgproc.hpp> 5 #include <opencv2/features2d/features2d.hpp> 6 #include "DistanceUtils.h" 19 class LBSP :
public cv::Feature2D {
22 LBSP(
size_t nThreshold);
24 LBSP(
float fRelThreshold,
size_t nThresholdOffset=0);
28 virtual void read(
const cv::FileNode&);
30 virtual void write(cv::FileStorage&)
const;
45 void compute2(
const cv::Mat& oImage, std::vector<cv::KeyPoint>& voKeypoints, cv::Mat& oDescriptors)
const;
47 void compute2(
const std::vector<cv::Mat>& voImageCollection, std::vector<std::vector<cv::KeyPoint> >& vvoPointCollection, std::vector<cv::Mat>& voDescCollection)
const;
50 inline static void computeGrayscaleDescriptor(
const cv::Mat& oInputImg,
const uchar _ref,
const int _x,
const int _y,
const size_t _t, ushort& _res) {
51 CV_DbgAssert(!oInputImg.empty());
52 CV_DbgAssert(oInputImg.type()==CV_8UC1);
56 const size_t _step_row = oInputImg.step.p[0];
57 const uchar*
const _data = oInputImg.data;
58 #include "LBSP_16bits_dbcross_1ch.i" 62 inline static void computeRGBDescriptor(
const cv::Mat& oInputImg,
const uchar*
const _ref,
const int _x,
const int _y,
const size_t*
const _t, ushort* _res) {
63 CV_DbgAssert(!oInputImg.empty());
64 CV_DbgAssert(oInputImg.type()==CV_8UC3);
68 const size_t _step_row = oInputImg.step.p[0];
69 const uchar*
const _data = oInputImg.data;
70 #include "LBSP_16bits_dbcross_3ch3t.i" 74 inline static void computeRGBDescriptor(
const cv::Mat& oInputImg,
const uchar*
const _ref,
const int _x,
const int _y,
const size_t _t, ushort* _res) {
75 CV_DbgAssert(!oInputImg.empty());
76 CV_DbgAssert(oInputImg.type()==CV_8UC3);
80 const size_t _step_row = oInputImg.step.p[0];
81 const uchar*
const _data = oInputImg.data;
82 #include "LBSP_16bits_dbcross_3ch1t.i" 86 inline static void computeSingleRGBDescriptor(
const cv::Mat& oInputImg,
const uchar _ref,
const int _x,
const int _y,
const size_t _c,
const size_t _t, ushort& _res) {
87 CV_DbgAssert(!oInputImg.empty());
88 CV_DbgAssert(oInputImg.type()==CV_8UC3 && _c<3);
92 const size_t _step_row = oInputImg.step.p[0];
93 const uchar*
const _data = oInputImg.data;
94 #include "LBSP_16bits_dbcross_s3ch.i" 98 static void reshapeDesc(cv::Size oSize,
const std::vector<cv::KeyPoint>& voKeypoints,
const cv::Mat& oDescriptors, cv::Mat& oOutput);
100 static void calcDescImgDiff(
const cv::Mat& oDesc1,
const cv::Mat& oDesc2, cv::Mat& oOutput,
bool bForceMergeChannels=
false);
102 static void validateKeyPoints(std::vector<cv::KeyPoint>& voKeypoints, cv::Size oImgSize);
112 virtual void computeImpl(
const cv::Mat& oImage, std::vector<cv::KeyPoint>& voKeypoints, cv::Mat& oDescriptors)
const;
114 const bool m_bOnlyUsingAbsThreshold;
115 const float m_fRelThreshold;
116 const size_t m_nThreshold;
virtual void write(cv::FileStorage &) const
writes extractor params to the specified file storage @@ not impl
Definition: LBSP.cpp:23
static void calcDescImgDiff(const cv::Mat &oDesc1, const cv::Mat &oDesc2, cv::Mat &oOutput, bool bForceMergeChannels=false)
utility function, used to illustrate the difference between two descriptor images ...
Definition: LBSP.cpp:262
static const size_t DESC_SIZE
utility, specifies the number of bytes per descriptor (should be the same as calling 'descriptorSize(...
Definition: LBSP.h:108
static void validateROI(cv::Mat &oROI)
utility function, used to filter out bad pixels in a ROI that would trigger out of bounds error becau...
Definition: LBSP.cpp:311
static void computeRGBDescriptor(const cv::Mat &oInputImg, const uchar *const _ref, const int _x, const int _y, const size_t *const _t, ushort *_res)
utility function, shortcut/lightweight/direct single-point LBSP computation function for extra flexib...
Definition: LBSP.h:62
virtual float getRelThreshold() const
returns the current relative threshold used for comparisons (-1 = invalid/not used) ...
Definition: LBSP.cpp:44
virtual void read(const cv::FileNode &)
loads extractor params from the specified file node @@ not impl
Definition: LBSP.cpp:19
virtual size_t getAbsThreshold() const
returns the current absolute threshold used for comparisons (-1 = invalid/not used) ...
Definition: LBSP.cpp:48
virtual ~LBSP()
default destructor
Definition: LBSP.cpp:17
virtual void setReference(const cv::Mat &)
sets the 'reference' image to be used for inter-frame comparisons (note: if no image is set or if the...
Definition: LBSP.cpp:27
virtual bool isUsingRelThreshold() const
returns whether this extractor is using a relative threshold or not
Definition: LBSP.cpp:40
LBSP(size_t nThreshold)
constructor 1, threshold = absolute intensity 'similarity' threshold used when computing comparisons ...
Definition: LBSP.cpp:3
static void computeRGBDescriptor(const cv::Mat &oInputImg, const uchar *const _ref, const int _x, const int _y, const size_t _t, ushort *_res)
utility function, shortcut/lightweight/direct single-point LBSP computation function for extra flexib...
Definition: LBSP.h:74
static void validateKeyPoints(std::vector< cv::KeyPoint > &voKeypoints, cv::Size oImgSize)
utility function, used to filter out bad keypoints that would trigger out of bounds error because the...
Definition: LBSP.cpp:307
static void computeGrayscaleDescriptor(const cv::Mat &oInputImg, const uchar _ref, const int _x, const int _y, const size_t _t, ushort &_res)
utility function, shortcut/lightweight/direct single-point LBSP computation function for extra flexib...
Definition: LBSP.h:50
virtual int descriptorSize() const
returns the current descriptor size, in bytes
Definition: LBSP.cpp:32
static void reshapeDesc(cv::Size oSize, const std::vector< cv::KeyPoint > &voKeypoints, const cv::Mat &oDescriptors, cv::Mat &oOutput)
utility function, used to reshape a descriptors matrix to its input image size via their keypoint loc...
Definition: LBSP.cpp:235
static void computeSingleRGBDescriptor(const cv::Mat &oInputImg, const uchar _ref, const int _x, const int _y, const size_t _c, const size_t _t, ushort &_res)
utility function, shortcut/lightweight/direct single-point LBSP computation function for extra flexib...
Definition: LBSP.h:86
virtual void computeImpl(const cv::Mat &oImage, std::vector< cv::KeyPoint > &voKeypoints, cv::Mat &oDescriptors) const
classic 'compute' implementation, based on the regular DescriptorExtractor::computeImpl arguments & e...
Definition: LBSP.cpp:221
virtual int descriptorType() const
returns the current descriptor data type
Definition: LBSP.cpp:36
void compute2(const cv::Mat &oImage, std::vector< cv::KeyPoint > &voKeypoints, cv::Mat &oDescriptors) const
similar to DescriptorExtractor::compute(const cv::Mat& image, ...), but in this case, the descriptors matrix has the same shape as the input matrix (possibly slower, but the result can be displayed)
Definition: LBSP.cpp:200
static const size_t PATCH_SIZE
utility, specifies the pixel size of the pattern used (width and height)
Definition: LBSP.h:106