Continue to refeactor the dynamic stuff - may have broken build on last commit.

Fairly certain that it builds now.
This commit is contained in:
Ethan Rublee 2010-11-23 22:45:49 +00:00
parent f6b0818996
commit 6a689d82a3
2 changed files with 30 additions and 5 deletions

View File

@ -1481,6 +1481,12 @@ public:
* Beware that this is not thread safe - as the adjustment of parameters breaks the const * Beware that this is not thread safe - as the adjustment of parameters breaks the const
* of the detection routine... * of the detection routine...
* /TODO Make this const correct and thread safe * /TODO Make this const correct and thread safe
*
* sample usage:
//will create a detector that attempts to find 100 - 110 FAST Keypoints, and will at most run
//FAST feature detection 10 times until that number of keypoints are found
Ptr<FeatureDetector> detector(new DynamicDetector (100, 110, 10,new FastAdjuster(20,true)));
*/ */
class CV_EXPORTS DynamicDetector: public FeatureDetector { class CV_EXPORTS DynamicDetector: public FeatureDetector {
public: public:
@ -1503,8 +1509,14 @@ private:
Ptr<AdjusterAdapter> adjuster_; Ptr<AdjusterAdapter> adjuster_;
}; };
class FastAdjuster: public AdjusterAdapter { /**\brief an adjust for the FAST detector. This will basically decrement or increment the
* threshhold by 1
*/
class CV_EXPORTS FastAdjuster: public AdjusterAdapter {
public: public:
/**\param init_thresh the initial threshhold to start with, default = 20
* \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);
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);
@ -1518,7 +1530,11 @@ protected:
}; };
struct StarAdjuster: public AdjusterAdapter {
/** An adjuster for StarFeatureDetector, this one adjusts the responseThreshold for now
* TODO find a faster way to converge the parameters for Star - use CvStarDetectorParams
*/
struct CV_EXPORTS StarAdjuster: public AdjusterAdapter {
StarAdjuster(double initial_thresh = 30.0); StarAdjuster(double initial_thresh = 30.0);
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);
@ -1528,9 +1544,10 @@ protected:
std::vector<cv::KeyPoint>& keypoints, const cv::Mat& mask = std::vector<cv::KeyPoint>& keypoints, const cv::Mat& mask =
cv::Mat()) const; cv::Mat()) const;
double thresh_; double thresh_;
CvStarDetectorParams params_; //todo use these instead of thresh_
}; };
struct SurfAdjuster: public AdjusterAdapter { struct CV_EXPORTS SurfAdjuster: public AdjusterAdapter {
SurfAdjuster(); SurfAdjuster();
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);
@ -1821,6 +1838,8 @@ struct CV_EXPORTS HammingLUT
typedef unsigned char ValueType; typedef unsigned char ValueType;
typedef int ResultType; typedef int ResultType;
/** this will count the bits in a ^ b
*/
ResultType operator()( const unsigned char* a, const unsigned char* b, int size ) const; ResultType operator()( const unsigned char* a, const unsigned char* b, int size ) const;
/** \brief given a byte, count the bits using a compile time generated look up table /** \brief given a byte, count the bits using a compile time generated look up table
@ -1838,7 +1857,13 @@ struct CV_EXPORTS HammingLUT
struct CV_EXPORTS Hamming struct CV_EXPORTS Hamming
{ {
typedef unsigned char ValueType; typedef unsigned char ValueType;
//! important that this is signed as weird behavior happens
// in BruteForce if not
typedef int ResultType; typedef int ResultType;
/** this will count the bits in a ^ b, using __builtin_popcountl try compiling with sse4
*/
ResultType operator()(const unsigned char* a, const unsigned char* b, int size) const; ResultType operator()(const unsigned char* a, const unsigned char* b, int size) const;
}; };

View File

@ -92,7 +92,7 @@ void pixelTests64(const Mat& sum, const std::vector<KeyPoint>& keypoints, Mat& d
namespace cv namespace cv
{ {
ResultType HammingLUT::operator()( const unsigned char* a, const unsigned char* b, int size ) const HammingLUT::ResultType HammingLUT::operator()( const unsigned char* a, const unsigned char* b, int size ) const
{ {
ResultType result = 0; ResultType result = 0;
for (int i = 0; i < size; i++) for (int i = 0; i < size; i++)
@ -101,7 +101,7 @@ ResultType HammingLUT::operator()( const unsigned char* a, const unsigned char*
} }
return result; return result;
} }
ResultType Hamming::operator()(const unsigned char* a, const unsigned char* b, int size) const Hamming::ResultType Hamming::operator()(const unsigned char* a, const unsigned char* b, int size) const
{ {
#if __GNUC__ #if __GNUC__
ResultType result = 0; ResultType result = 0;