Commit fba71a8e authored by biagio montesano's avatar biagio montesano

Added methods for derivation from FeatureDetector

parent 0863960c
...@@ -53,18 +53,32 @@ ...@@ -53,18 +53,32 @@
namespace cv namespace cv
{ {
class CV_EXPORTS_W LineDescriptor : public virtual Algorithm class CV_EXPORTS_W KeyLine: public KeyPoint
{ {
public: public:
virtual ~LineDescriptor(); /* lines's extremes in original image */
void getLineBinaryDescriptors(cv::Mat &oct_binaryDescMat); float startPointX;
float startPointY;
float endPointX;
float endPointY;
/* line's extremes in image it was extracted from */
float sPointInOctaveX;
float sPointInOctaveY;
float ePointInOctaveX;
float ePointInOctaveY;
/* the length of line */
float lineLength;
/* number of pixels covered by the line */
unsigned int numOfPixels;
protected:
virtual void getLineBinaryDescriptorsImpl(cv::Mat &oct_binaryDescMat);
}; };
class CV_EXPORTS_W BinaryDescriptor : public LineDescriptor class CV_EXPORTS_W BinaryDescriptor : public DescriptorExtractor
{ {
public: public:
...@@ -92,7 +106,10 @@ namespace cv ...@@ -92,7 +106,10 @@ namespace cv
/* image's reduction ratio in construction of Gaussian pyramids */ /* image's reduction ratio in construction of Gaussian pyramids */
CV_PROP_RW int reductionRatio; CV_PROP_RW int reductionRatio;
/* read parameters from a FileNode object and store them (struct function) */
void read( const FileNode& fn ); void read( const FileNode& fn );
/* store parameters to a FileStorage object (struct function) */
void write( FileStorage& fs ) const; void write( FileStorage& fs ) const;
}; };
...@@ -100,29 +117,63 @@ namespace cv ...@@ -100,29 +117,63 @@ namespace cv
CV_WRAP BinaryDescriptor(const BinaryDescriptor::Params &parameters = CV_WRAP BinaryDescriptor(const BinaryDescriptor::Params &parameters =
BinaryDescriptor::Params()); BinaryDescriptor::Params());
/* read parameters from a FileNode object and store them (class function ) */
virtual void read( const cv::FileNode& fn ); virtual void read( const cv::FileNode& fn );
/* store parameters to a FileStorage object (class function) */
virtual void write( cv::FileStorage& fs ) const; virtual void write( cv::FileStorage& fs ) const;
void getLineBinaryDescriptors(cv::Mat &oct_binaryDescMat);
/* requires line detection (only one image) */
CV_WRAP void detect( const Mat& image,
CV_OUT std::vector<KeyPoint>& keypoints,
const Mat& mask=Mat() );
protected: /* requires line detection (more than one image) */
virtual void getLineBinaryDescriptorsImpl(cv::Mat &oct_binaryDescMat); void detect( const std::vector<Mat>& images,
AlgorithmInfo* info() const; std::vector<std::vector<KeyPoint> >& keypoints,
const std::vector<Mat>& masks=std::vector<Mat>() ) const;
Params params; /*return descriptor size */
int descriptorSize() const = 0;
/* return data type */
int descriptorType() const = 0;
/* return norm mode */
int defaultNorm() const = 0;
/* check whether Gaussian pyramids were created */
bool empty() const;
protected:
virtual void detectImpl( const Mat& image,
std::vector<KeyPoint>& keypoints,
const Mat& mask=Mat() ) const = 0;
AlgorithmInfo* info() const;
private: private:
/* conversion of an LBD descriptor to the decimal equivalent of its binary representation */
unsigned char binaryTest(float* f1, float* f2); unsigned char binaryTest(float* f1, float* f2);
/* compute LBD descriptors */
int ComputeLBD_(ScaleLines &keyLines); int ComputeLBD_(ScaleLines &keyLines);
int OctaveKeyLines(std::vector<cv::Mat> & octaveImages, ScaleLines &keyLines);
/* gather lines in groups.
Each group contains the same line, detected in different octaves */
int OctaveKeyLines(ScaleLines &keyLines);
/* get coefficients of line passing by two points (in line_extremes) */
void getLineParameters(cv::Vec4i &line_extremes, cv::Vec3i &lineParams); void getLineParameters(cv::Vec4i &line_extremes, cv::Vec3i &lineParams);
/* compute the angle between line and X axis */
float getLineDirection(cv::Vec3i &lineParams); float getLineDirection(cv::Vec3i &lineParams);
/* the local gaussian coefficient apply to the orthogonal line direction within each band */ /* the local gaussian coefficient applied to the orthogonal line direction within each band */
std::vector<float> gaussCoefL_; std::vector<float> gaussCoefL_;
/* the global gaussian coefficient apply to each Row within line support region */ /* the global gaussian coefficient applied to each Row within line support region */
std::vector<float> gaussCoefG_; std::vector<float> gaussCoefG_;
/* vector to store horizontal and vertical derivatives of octave images */ /* vector to store horizontal and vertical derivatives of octave images */
...@@ -134,6 +185,12 @@ namespace cv ...@@ -134,6 +185,12 @@ namespace cv
/* structure to store lines extracted from each octave image */ /* structure to store lines extracted from each octave image */
std::vector<std::vector<cv::Vec4i> > extractedLines; 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;
}; };
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment