Commit b5163291 authored by Maria Dimashova's avatar Maria Dimashova

added upright mode to SURF (#825)

parent 2d2b8a49
......@@ -81,6 +81,7 @@ CV_INLINE CvSURFPoint cvSURFPoint( CvPoint2D32f pt, int laplacian,
typedef struct CvSURFParams
{
int extended;
int upright;
double hessianThreshold;
int nOctaves;
......@@ -395,7 +396,7 @@ public:
CV_WRAP SURF();
//! the full constructor taking all the necessary parameters
CV_WRAP SURF(double _hessianThreshold, int _nOctaves=4,
int _nOctaveLayers=2, bool _extended=false);
int _nOctaveLayers=2, bool _extended=false, bool _upright=false);
//! returns the descriptor size in float's (64 or 128)
CV_WRAP int descriptorSize() const;
......@@ -1519,7 +1520,7 @@ protected:
class CV_EXPORTS SurfFeatureDetector : public FeatureDetector
{
public:
SurfFeatureDetector( double hessianThreshold=400., int octaves=3, int octaveLayers=4 );
SurfFeatureDetector( double hessianThreshold=400., int octaves=3, int octaveLayers=4, bool upright=false );
virtual void read( const FileNode& fn );
virtual void write( FileStorage& fs ) const;
......@@ -1897,7 +1898,7 @@ protected:
class CV_EXPORTS SurfDescriptorExtractor : public DescriptorExtractor
{
public:
SurfDescriptorExtractor( int nOctaves=4, int nOctaveLayers=2, bool extended=false );
SurfDescriptorExtractor( int nOctaves=4, int nOctaveLayers=2, bool extended=false, bool upright=false );
virtual void read( const FileNode &fn );
virtual void write( FileStorage &fs ) const;
......@@ -1906,7 +1907,7 @@ public:
virtual int descriptorType() const;
protected:
virtual void computeImpl( const Mat& image, vector<KeyPoint>& keypoints, Mat& descriptors ) const;
virtual void computeImpl( const Mat& image, vector<KeyPoint>& keypoints, Mat& descriptors ) const;
SURF surf;
};
......
......@@ -191,8 +191,8 @@ int SiftDescriptorExtractor::descriptorType() const
* SurfDescriptorExtractor *
\****************************************************************************************/
SurfDescriptorExtractor::SurfDescriptorExtractor( int nOctaves,
int nOctaveLayers, bool extended )
: surf( 0.0, nOctaves, nOctaveLayers, extended )
int nOctaveLayers, bool extended, bool upright )
: surf( 0.0, nOctaves, nOctaveLayers, extended, upright )
{}
void SurfDescriptorExtractor::computeImpl( const Mat& image,
......@@ -218,8 +218,9 @@ void SurfDescriptorExtractor::read( const FileNode &fn )
int nOctaves = fn["nOctaves"];
int nOctaveLayers = fn["nOctaveLayers"];
bool extended = (int)fn["extended"] != 0;
bool upright = (int)fn["upright"] != 0;
surf = SURF( 0.0, nOctaves, nOctaveLayers, extended );
surf = SURF( 0.0, nOctaves, nOctaveLayers, extended, upright );
}
void SurfDescriptorExtractor::write( FileStorage &fs ) const
......@@ -229,6 +230,7 @@ void SurfDescriptorExtractor::write( FileStorage &fs ) const
fs << "nOctaves" << surf.nOctaves;
fs << "nOctaveLayers" << surf.nOctaveLayers;
fs << "extended" << surf.extended;
fs << "upright" << surf.upright;
}
int SurfDescriptorExtractor::descriptorSize() const
......
......@@ -407,8 +407,8 @@ void SiftFeatureDetector::detectImpl( const Mat& image, vector<KeyPoint>& keypoi
/*
* SurfFeatureDetector
*/
SurfFeatureDetector::SurfFeatureDetector( double hessianThreshold, int octaves, int octaveLayers)
: surf(hessianThreshold, octaves, octaveLayers)
SurfFeatureDetector::SurfFeatureDetector( double hessianThreshold, int octaves, int octaveLayers, bool upright )
: surf(hessianThreshold, octaves, octaveLayers, false, upright)
{}
void SurfFeatureDetector::read (const FileNode& fn)
......@@ -416,8 +416,9 @@ void SurfFeatureDetector::read (const FileNode& fn)
double hessianThreshold = fn["hessianThreshold"];
int octaves = fn["octaves"];
int octaveLayers = fn["octaveLayers"];
bool upright = (int)fn["upright"] != 0;
surf = SURF( hessianThreshold, octaves, octaveLayers );
surf = SURF( hessianThreshold, octaves, octaveLayers, false, upright );
}
void SurfFeatureDetector::write (FileStorage& fs) const
......@@ -427,6 +428,7 @@ void SurfFeatureDetector::write (FileStorage& fs) const
fs << "hessianThreshold" << surf.hessianThreshold;
fs << "octaves" << surf.nOctaves;
fs << "octaveLayers" << surf.nOctaveLayers;
fs << "upright" << surf.upright;
}
void SurfFeatureDetector::detectImpl( const Mat& image, vector<KeyPoint>& keypoints, const Mat& mask ) const
......
This diff is collapsed.
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