diff --git a/modules/features2d/include/opencv2/features2d/features2d.hpp b/modules/features2d/include/opencv2/features2d/features2d.hpp index 6a555cbb41..cc99e1fae4 100644 --- a/modules/features2d/include/opencv2/features2d/features2d.hpp +++ b/modules/features2d/include/opencv2/features2d/features2d.hpp @@ -253,11 +253,8 @@ public: static const int DEFAULT_FIRST_OCTAVE = -1; enum{ FIRST_ANGLE = 0, AVERAGE_ANGLE = 1 }; - CommonParams() : nOctaves(DEFAULT_NOCTAVES), nOctaveLayers(DEFAULT_NOCTAVE_LAYERS), - firstOctave(DEFAULT_FIRST_OCTAVE), angleMode(FIRST_ANGLE) {} - CommonParams( int _nOctaves, int _nOctaveLayers, int _firstOctave, int _angleMode ) : - nOctaves(_nOctaves), nOctaveLayers(_nOctaveLayers), - firstOctave(_firstOctave), angleMode(_angleMode) {} + CommonParams(); + CommonParams( int _nOctaves, int _nOctaveLayers, int _firstOctave, int _angleMode ); int nOctaves, nOctaveLayers, firstOctave; int angleMode; }; @@ -267,9 +264,8 @@ public: static double GET_DEFAULT_THRESHOLD() { return 0.04 / SIFT::CommonParams::DEFAULT_NOCTAVE_LAYERS / 2.0; } static double GET_DEFAULT_EDGE_THRESHOLD() { return 10.0; } - DetectorParams() : threshold(GET_DEFAULT_THRESHOLD()), edgeThreshold(GET_DEFAULT_EDGE_THRESHOLD()) {} - DetectorParams( double _threshold, double _edgeThreshold ) : - threshold(_threshold), edgeThreshold(_edgeThreshold) {} + DetectorParams(); + DetectorParams( double _threshold, double _edgeThreshold ); double threshold, edgeThreshold; }; @@ -278,11 +274,9 @@ public: static double GET_DEFAULT_MAGNIFICATION() { return 3.0; } static const bool DEFAULT_IS_NORMALIZE = true; static const int DESCRIPTOR_SIZE = 128; - DescriptorParams() : magnification(GET_DEFAULT_MAGNIFICATION()), isNormalize(DEFAULT_IS_NORMALIZE), - recalculateAngles(true) {} - DescriptorParams( double _magnification, bool _isNormalize, bool _recalculateAngles ) : - magnification(_magnification), isNormalize(_isNormalize), - recalculateAngles(_recalculateAngles) {} + + DescriptorParams(); + DescriptorParams( double _magnification, bool _isNormalize, bool _recalculateAngles ); double magnification; bool isNormalize; bool recalculateAngles; @@ -311,7 +305,8 @@ public: //! finds the keypoints using SIFT algorithm void operator()(const Mat& img, const Mat& mask, vector& keypoints) const; - //! finds the keypoints and computes descriptors for them using SIFT algorithm. Optionally it can compute descriptors for the user-provided keypoints + //! finds the keypoints and computes descriptors for them using SIFT algorithm. + //! Optionally it can compute descriptors for the user-provided keypoints void operator()(const Mat& img, const Mat& mask, vector& keypoints, Mat& descriptors, @@ -1284,8 +1279,8 @@ public: detectImpl( image, mask, keypoints ); } - virtual void read (const FileNode& fn) {}; - virtual void write (FileStorage& fs) const {}; + virtual void read(const FileNode& fn) {}; + virtual void write(FileStorage& fs) const {}; protected: /* diff --git a/modules/features2d/src/sift.cpp b/modules/features2d/src/sift.cpp index 3134e86cc4..c8f63c4ef4 100644 --- a/modules/features2d/src/sift.cpp +++ b/modules/features2d/src/sift.cpp @@ -1978,6 +1978,34 @@ Sift::computeKeypointDescriptor using namespace cv; +SIFT::CommonParams::CommonParams() : + nOctaves(DEFAULT_NOCTAVES), nOctaveLayers(DEFAULT_NOCTAVE_LAYERS), + firstOctave(DEFAULT_FIRST_OCTAVE), angleMode(FIRST_ANGLE) +{} + +SIFT::CommonParams::CommonParams( int _nOctaves, int _nOctaveLayers, int _firstOctave, int _angleMode ) : + nOctaves(_nOctaves), nOctaveLayers(_nOctaveLayers), + firstOctave(_firstOctave), angleMode(_angleMode) +{} + +SIFT::DetectorParams::DetectorParams() : + threshold(GET_DEFAULT_THRESHOLD()), edgeThreshold(GET_DEFAULT_EDGE_THRESHOLD()) +{} + +SIFT::DetectorParams::DetectorParams( double _threshold, double _edgeThreshold ) : + threshold(_threshold), edgeThreshold(_edgeThreshold) +{} + +SIFT::DescriptorParams::DescriptorParams() : + magnification(GET_DEFAULT_MAGNIFICATION()), isNormalize(DEFAULT_IS_NORMALIZE), + recalculateAngles(true) +{} + +SIFT::DescriptorParams::DescriptorParams( double _magnification, bool _isNormalize, bool _recalculateAngles ) : + magnification(_magnification), isNormalize(_isNormalize), + recalculateAngles(_recalculateAngles) +{} + SIFT::SIFT() {}