Commit af28d19b authored by Maria Dimashova's avatar Maria Dimashova

extended the constructor parameters of AdjusterAdapter's inheritors

parent c98c87d5
...@@ -1550,7 +1550,7 @@ public: ...@@ -1550,7 +1550,7 @@ public:
/**\param init_thresh the initial threshold to start with, default = 20 /**\param init_thresh the initial threshold to start with, default = 20
* \param nonmax whether to use non max or not for fast feature detection * \param nonmax whether to use non max or not for fast feature detection
*/ */
FastAdjuster(int init_thresh = 20, bool nonmax = true); FastAdjuster(int init_thresh=20, bool nonmax=true, int min_thresh=1, int max_thresh=200);
virtual void tooFew(int min, int n_detected); virtual void tooFew(int min, int n_detected);
virtual void tooMany(int max, int n_detected); virtual void tooMany(int max, int n_detected);
...@@ -1563,7 +1563,7 @@ protected: ...@@ -1563,7 +1563,7 @@ protected:
int thresh_; int thresh_;
bool nonmax_; bool nonmax_;
int init_thresh_; int init_thresh_, min_thresh_, max_thresh_;
}; };
...@@ -1573,7 +1573,7 @@ protected: ...@@ -1573,7 +1573,7 @@ protected:
class CV_EXPORTS StarAdjuster: public AdjusterAdapter class CV_EXPORTS StarAdjuster: public AdjusterAdapter
{ {
public: public:
StarAdjuster(double initial_thresh = 30.0); StarAdjuster(double initial_thresh=30.0, double min_thresh=2., double max_thresh=200.);
virtual void tooFew(int min, int n_detected); virtual void tooFew(int min, int n_detected);
virtual void tooMany(int max, int n_detected); virtual void tooMany(int max, int n_detected);
...@@ -1584,14 +1584,14 @@ public: ...@@ -1584,14 +1584,14 @@ public:
protected: protected:
virtual void detectImpl( const Mat& image, vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const; virtual void detectImpl( const Mat& image, vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const;
double thresh_, init_thresh_; double thresh_, init_thresh_, min_thresh_, max_thresh_;
CvStarDetectorParams params_; //todo use these instead of thresh_ CvStarDetectorParams params_; //todo use these instead of thresh_
}; };
class CV_EXPORTS SurfAdjuster: public AdjusterAdapter class CV_EXPORTS SurfAdjuster: public AdjusterAdapter
{ {
public: public:
SurfAdjuster( double initial_thresh=400.f ); SurfAdjuster( double initial_thresh=400.f, double min_thresh=2, double max_thresh=1000 );
virtual void tooFew(int min, int n_detected); virtual void tooFew(int min, int n_detected);
virtual void tooMany(int max, int n_detected); virtual void tooMany(int max, int n_detected);
...@@ -1602,7 +1602,7 @@ public: ...@@ -1602,7 +1602,7 @@ public:
protected: protected:
virtual void detectImpl( const Mat& image, vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const; virtual void detectImpl( const Mat& image, vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const;
double thresh_, init_thresh_; double thresh_, init_thresh_, min_thresh_, max_thresh_;
}; };
CV_EXPORTS Mat windowedMatchingMask( const vector<KeyPoint>& keypoints1, const vector<KeyPoint>& keypoints2, CV_EXPORTS Mat windowedMatchingMask( const vector<KeyPoint>& keypoints1, const vector<KeyPoint>& keypoints2,
......
...@@ -93,8 +93,9 @@ void DynamicAdaptedFeatureDetector::detectImpl(const Mat& image, vector<KeyPoint ...@@ -93,8 +93,9 @@ void DynamicAdaptedFeatureDetector::detectImpl(const Mat& image, vector<KeyPoint
} }
FastAdjuster::FastAdjuster(int init_thresh, bool nonmax) : FastAdjuster::FastAdjuster( int init_thresh, bool nonmax, int min_thresh, int max_thresh ) :
thresh_(init_thresh), nonmax_(nonmax), init_thresh_(init_thresh) thresh_(init_thresh), nonmax_(nonmax), init_thresh_(init_thresh),
min_thresh_(min_thresh), max_thresh_(max_thresh)
{} {}
void FastAdjuster::detectImpl(const Mat& image, vector<KeyPoint>& keypoints, const Mat& mask) const void FastAdjuster::detectImpl(const Mat& image, vector<KeyPoint>& keypoints, const Mat& mask) const
...@@ -118,17 +119,18 @@ void FastAdjuster::tooMany(int, int) ...@@ -118,17 +119,18 @@ void FastAdjuster::tooMany(int, int)
//a useful point //a useful point
bool FastAdjuster::good() const bool FastAdjuster::good() const
{ {
return (thresh_ > 1) && (thresh_ < 200); return (thresh_ > min_thresh_) && (thresh_ < max_thresh_);
} }
Ptr<AdjusterAdapter> FastAdjuster::clone() const Ptr<AdjusterAdapter> FastAdjuster::clone() const
{ {
Ptr<AdjusterAdapter> cloned_obj = new FastAdjuster( init_thresh_, nonmax_ ); Ptr<AdjusterAdapter> cloned_obj = new FastAdjuster( init_thresh_, nonmax_, min_thresh_, max_thresh_ );
return cloned_obj; return cloned_obj;
} }
StarAdjuster::StarAdjuster(double initial_thresh) : StarAdjuster::StarAdjuster(double initial_thresh, double min_thresh, double max_thresh) :
thresh_(initial_thresh), init_thresh_(initial_thresh) thresh_(initial_thresh), init_thresh_(initial_thresh),
min_thresh_(min_thresh), max_thresh_(max_thresh)
{} {}
void StarAdjuster::detectImpl(const Mat& image, vector<KeyPoint>& keypoints, const Mat& mask) const void StarAdjuster::detectImpl(const Mat& image, vector<KeyPoint>& keypoints, const Mat& mask) const
...@@ -151,17 +153,18 @@ void StarAdjuster::tooMany(int, int) ...@@ -151,17 +153,18 @@ void StarAdjuster::tooMany(int, int)
bool StarAdjuster::good() const bool StarAdjuster::good() const
{ {
return (thresh_ > 2) && (thresh_ < 200); return (thresh_ > min_thresh_) && (thresh_ < max_thresh_);
} }
Ptr<AdjusterAdapter> StarAdjuster::clone() const Ptr<AdjusterAdapter> StarAdjuster::clone() const
{ {
Ptr<AdjusterAdapter> cloned_obj = new StarAdjuster( init_thresh_ ); Ptr<AdjusterAdapter> cloned_obj = new StarAdjuster( init_thresh_, min_thresh_, max_thresh_ );
return cloned_obj; return cloned_obj;
} }
SurfAdjuster::SurfAdjuster( double initial_thresh ) : SurfAdjuster::SurfAdjuster( double initial_thresh, double min_thresh, double max_thresh ) :
thresh_(initial_thresh), init_thresh_(initial_thresh) thresh_(initial_thresh), init_thresh_(initial_thresh),
min_thresh_(min_thresh), max_thresh_(max_thresh)
{} {}
void SurfAdjuster::detectImpl(const Mat& image, vector<KeyPoint>& keypoints, const cv::Mat& mask) const void SurfAdjuster::detectImpl(const Mat& image, vector<KeyPoint>& keypoints, const cv::Mat& mask) const
...@@ -186,12 +189,12 @@ void SurfAdjuster::tooMany(int, int) ...@@ -186,12 +189,12 @@ void SurfAdjuster::tooMany(int, int)
//a useful point //a useful point
bool SurfAdjuster::good() const bool SurfAdjuster::good() const
{ {
return (thresh_ > 2) && (thresh_ < 1000); return (thresh_ > min_thresh_) && (thresh_ < max_thresh_);
} }
Ptr<AdjusterAdapter> SurfAdjuster::clone() const Ptr<AdjusterAdapter> SurfAdjuster::clone() const
{ {
Ptr<AdjusterAdapter> cloned_obj = new SurfAdjuster( init_thresh_ ); Ptr<AdjusterAdapter> cloned_obj = new SurfAdjuster( init_thresh_, min_thresh_, max_thresh_ );
return cloned_obj; return cloned_obj;
} }
......
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