mirror of
https://github.com/opencv/opencv_contrib.git
synced 2025-10-17 07:04:18 +08:00
New warnings corrected
This commit is contained in:
@@ -43,7 +43,6 @@
|
||||
#define __OPENCV_LINE_DESCRIPTOR_HPP__
|
||||
|
||||
#include "opencv2/line_descriptor/descriptor.hpp"
|
||||
//#include "opencv2/core.hpp"
|
||||
|
||||
namespace cv
|
||||
{
|
||||
|
@@ -134,15 +134,6 @@ class CV_EXPORTS_W BinaryDescriptor : public Algorithm
|
||||
|
||||
};
|
||||
|
||||
struct CV_EXPORTS LineDetectionMode
|
||||
{
|
||||
enum
|
||||
{
|
||||
LSD_DETECTOR = 0, // detect lines using LSD
|
||||
EDL_DETECTOR = 1 // detect lines using EDLines
|
||||
};
|
||||
};
|
||||
|
||||
/* constructor */
|
||||
CV_WRAP
|
||||
BinaryDescriptor( const BinaryDescriptor::Params ¶meters = BinaryDescriptor::Params() );
|
||||
@@ -162,53 +153,48 @@ class CV_EXPORTS_W BinaryDescriptor : public Algorithm
|
||||
int getReductionRatio();
|
||||
void setReductionRatio( int rRatio );
|
||||
|
||||
/* read parameters from a FileNode object and store them (class function ) */
|
||||
/* reads parameters from a FileNode object and store them (class function ) */
|
||||
virtual void read( const cv::FileNode& fn );
|
||||
|
||||
/* store parameters to a FileStorage object (class function) */
|
||||
/* stores parameters to a FileStorage object (class function) */
|
||||
virtual void write( cv::FileStorage& fs ) const;
|
||||
|
||||
/* requires line detection (only one image) */
|
||||
CV_WRAP
|
||||
void detect( const Mat& image, CV_OUT std::vector<KeyLine>& keypoints, const Mat& mask = Mat(), int flags = LineDetectionMode::LSD_DETECTOR );
|
||||
void detect( const Mat& image, CV_OUT std::vector<KeyLine>& keypoints, const Mat& mask = Mat() );
|
||||
|
||||
/* requires line detection (more than one image) */
|
||||
void detect( const std::vector<Mat>& images, std::vector<std::vector<KeyLine> >& keylines, const std::vector<Mat>& masks = std::vector<Mat>(),
|
||||
int flags = LineDetectionMode::LSD_DETECTOR ) const;
|
||||
void detect( const std::vector<Mat>& images, std::vector<std::vector<KeyLine> >& keylines, const std::vector<Mat>& masks =
|
||||
std::vector<Mat>() ) const;
|
||||
|
||||
/* requires descriptors computation (only one image) */
|
||||
CV_WRAP
|
||||
void compute( const Mat& image, CV_OUT CV_IN_OUT std::vector<KeyLine>& keylines, CV_OUT Mat& descriptors, bool returnFloatDescr = false, int flags =
|
||||
LineDetectionMode::LSD_DETECTOR ) const;
|
||||
void compute( const Mat& image, CV_OUT CV_IN_OUT std::vector<KeyLine>& keylines, CV_OUT Mat& descriptors, bool returnFloatDescr = false ) const;
|
||||
|
||||
/* requires descriptors computation (more than one image) */
|
||||
void compute( const std::vector<Mat>& images, std::vector<std::vector<KeyLine> >& keylines, std::vector<Mat>& descriptors, bool returnFloatDescr =
|
||||
false,
|
||||
int flags = LineDetectionMode::LSD_DETECTOR ) const;
|
||||
false ) const;
|
||||
|
||||
/*return descriptor size */
|
||||
/* returns descriptor size */
|
||||
int descriptorSize() const;
|
||||
|
||||
/* return data type */
|
||||
/* returns data type */
|
||||
int descriptorType() const;
|
||||
|
||||
/* return norm mode */
|
||||
/* returns norm mode */
|
||||
int defaultNorm() const;
|
||||
|
||||
/* check whether Gaussian pyramids were created */
|
||||
bool empty() const;
|
||||
|
||||
/* definition of operator () */
|
||||
CV_WRAP_AS(detectAndCompute)
|
||||
virtual void operator()( InputArray image, InputArray mask, CV_OUT std::vector<KeyLine>& keylines, OutputArray descriptors,
|
||||
bool useProvidedKeyLines = false, bool returnFloatDescr = false, int flags = LineDetectionMode::LSD_DETECTOR ) const;
|
||||
bool useProvidedKeyLines = false, bool returnFloatDescr = false ) const;
|
||||
|
||||
protected:
|
||||
/* implementation of line detection */
|
||||
virtual void detectImpl( const Mat& imageSrc, std::vector<KeyLine>& keylines, int flags, const Mat& mask = Mat() ) const;
|
||||
virtual void detectImpl( const Mat& imageSrc, std::vector<KeyLine>& keylines, const Mat& mask = Mat() ) const;
|
||||
|
||||
/* implementation of descriptors' computation */
|
||||
virtual void computeImpl( const Mat& imageSrc, std::vector<KeyLine>& keylines, Mat& descriptors, bool returnFloatDescr, int flags ) const;
|
||||
virtual void computeImpl( const Mat& imageSrc, std::vector<KeyLine>& keylines, Mat& descriptors, bool returnFloatDescr ) const;
|
||||
|
||||
/* function inherited from Algorithm */
|
||||
AlgorithmInfo* info() const;
|
||||
@@ -217,49 +203,24 @@ class CV_EXPORTS_W BinaryDescriptor : public Algorithm
|
||||
/* conversion of an LBD descriptor to its binary representation */
|
||||
unsigned char binaryConversion( float* f1, float* f2 );
|
||||
|
||||
/* compute LBD descriptors */
|
||||
int computeLBD( ScaleLines &keyLines, int flags );
|
||||
|
||||
/* compute LBD descriptors using EDLine extractor */
|
||||
int computeLBD_EDL( ScaleLines &keyLines );
|
||||
int computeLBD( ScaleLines &keyLines );
|
||||
|
||||
/* compute Gaussian pyramid of input image */
|
||||
void computeGaussianPyramid( const Mat& image );
|
||||
|
||||
/* gather lines in groups.
|
||||
/* gathers lines in groups using EDLine extractor.
|
||||
Each group contains the same line, detected in different octaves */
|
||||
int OctaveKeyLines( ScaleLines &keyLines );
|
||||
|
||||
/* gather lines in groups using EDLine extractor.
|
||||
Each group contains the same line, detected in different octaves */
|
||||
int OctaveKeyLines_EDL( cv::Mat& image, ScaleLines &keyLines );
|
||||
|
||||
/* get coefficients of line passing by two points (in line_extremes) */
|
||||
void getLineParameters( cv::Vec4i &line_extremes, cv::Vec3i &lineParams );
|
||||
|
||||
/* compute the angle between line and X axis */
|
||||
float getLineDirection( cv::Vec3i &lineParams );
|
||||
int OctaveKeyLines( cv::Mat& image, ScaleLines &keyLines );
|
||||
|
||||
/* the local gaussian coefficient applied to the orthogonal line direction within each band */
|
||||
std::vector<float> gaussCoefL_;
|
||||
|
||||
/* the global gaussian coefficient applied to each Row within line support region */
|
||||
/* the global gaussian coefficient applied to each row within line support region */
|
||||
std::vector<float> gaussCoefG_;
|
||||
|
||||
/* vector to store horizontal and vertical derivatives of octave images */
|
||||
std::vector<cv::Mat> dxImg_vector, dyImg_vector;
|
||||
|
||||
/* vectot to store sizes of octave images */
|
||||
std::vector<cv::Size> images_sizes;
|
||||
|
||||
/* structure to store lines extracted from each octave image */
|
||||
std::vector<std::vector<cv::Vec4i> > extractedLines;
|
||||
|
||||
/* descriptor parameters */
|
||||
Params params;
|
||||
|
||||
/* vector to store the Gaussian pyramid od an input image */
|
||||
std::vector<cv::Mat> octaveImages;
|
||||
/* vector of sizes of downsampled and blurred images */
|
||||
std::vector<cv::Size> images_sizes;
|
||||
|
||||
/*For each octave of image, we define an EDLineDetector, because we can get gradient images (dxImg, dyImg, gImg)
|
||||
*from the EDLineDetector class without extra computation cost. Another reason is that, if we use
|
||||
@@ -269,6 +230,42 @@ class CV_EXPORTS_W BinaryDescriptor : public Algorithm
|
||||
|
||||
};
|
||||
|
||||
class CV_EXPORTS_W LSDDetector : public Algorithm
|
||||
{
|
||||
public:
|
||||
|
||||
/* constructor */
|
||||
LSDDetector()
|
||||
{
|
||||
}
|
||||
;
|
||||
|
||||
/* constructor with smart pointer */
|
||||
static Ptr<LSDDetector> createLSDDetector();
|
||||
|
||||
/* requires line detection (only one image) */
|
||||
CV_WRAP
|
||||
void detect( const Mat& image, CV_OUT std::vector<KeyLine>& keypoints, int scale, int numOctaves, const Mat& mask = Mat() );
|
||||
|
||||
/* requires line detection (more than one image) */
|
||||
void detect( const std::vector<Mat>& images, std::vector<std::vector<KeyLine> >& keylines, int scale, int numOctaves,
|
||||
const std::vector<Mat>& masks = std::vector<Mat>() ) const;
|
||||
|
||||
private:
|
||||
/* compute Gaussian pyramid of input image */
|
||||
void computeGaussianPyramid( const Mat& image, int numOctaves, int scale );
|
||||
|
||||
/* implementation of line detection */
|
||||
void detectImpl( const Mat& imageSrc, std::vector<KeyLine>& keylines, int numOctaves, int scale, const Mat& mask ) const;
|
||||
|
||||
/* matrices for Gaussian pyramids */
|
||||
std::vector<cv::Mat> gaussianPyrs;
|
||||
|
||||
protected:
|
||||
/* function inherited from Algorithm */
|
||||
AlgorithmInfo* info() const;
|
||||
};
|
||||
|
||||
class CV_EXPORTS_W BinaryDescriptorMatcher : public Algorithm
|
||||
{
|
||||
|
||||
|
Reference in New Issue
Block a user