Functions for detecting corners of various types.


Classes

struct  SearchThreshold
 This class wraps a DetectT class with binary_search_threshold and presents is as a DetectN class. More...
struct  Random
 Detector which randomly scatters corners around an image. More...
struct  DetectN
 A corner detector object which is passed a target number of corners to detect. More...
struct  DetectT
 A corner detector object which is passed a threshold. More...
struct  dog
 Class wrapping the Difference of Gaussians detector. More...
struct  harrisdog
 Class wrapping the Harris-Laplace detector. More...
struct  faster_learn
 FAST-ER detector. More...
struct  ShiTomasiDetect
 Class wrapping the Harris detector. More...
struct  HarrisDetect
 Class wrapping the Shi-Tomasi detector. More...
struct  SUSAN
 Class wrapping the SUSAN detector. More...

Functions

int binary_search_threshold (const Image< byte > &i, vector< ImageRef > &c, unsigned int N, const DetectT &detector)
auto_ptr< DetectNget_detector ()
void HarrisDetector (const CVD::Image< float > &i, std::vector< std::pair< float, CVD::ImageRef > > &c, unsigned int N, float blur, float sigmas)


Function Documentation

int binary_search_threshold ( const Image< byte > &  i,
vector< ImageRef > &  c,
unsigned int  N,
const DetectT detector 
)

This takes a detector which requires a threshold and uses binary search to get as close as possible to the requested number of corners.

Parameters:
i The image in which to detect corners.
c The detected corners to be returned.
N The target number of corners.
detector The corner detector.

Definition at line 47 of file detectors.cc.

Referenced by SearchThreshold::operator()().

00048 {
00049     //Corners for high, low and midpoint thresholds.
00050     vector<ImageRef> ch, cl, cm;
00051     
00052     //The high and low thresholds.
00053     unsigned int t_high = 256;
00054     unsigned int t_low = 0;
00055 
00056 
00057     detector(i, ch, t_high);
00058     detector(i, cl, t_low);
00059 
00060     while(t_high > t_low + 1)
00061     {
00062     
00063         cm.clear();
00064         unsigned int t = (t_high + t_low    ) / 2;
00065         detector(i, cm, t);
00066 
00067         if(cm.size() == N)
00068         {
00069             c = cm;
00070             return t;
00071         }
00072         else if(cm.size() < N) //If we detected too few points, then the t is too high
00073         {
00074             t_high = t;
00075             ch = cm;
00076         }
00077         else //We detected too many points to t is too low.
00078         {
00079             t_low = t;
00080             cl = cm;
00081         }
00082     }
00083 
00084     //Pick the closest
00085     //If there is ambiguity, go with the lower threshold (more corners).
00086     //The only reason for this is that the evaluation code in the FAST-ER
00087     //system uses this rule.
00088     if( N - ch.size() >= cl.size() - N)
00089     {
00090         c = cl;
00091         return t_low;
00092     }
00093     else
00094     { 
00095         c = ch;
00096         return t_high;
00097     }
00098 }

auto_ptr<DetectN> get_detector (  ) 

Very simple factory function for getting detector objects.

Get a corner detector.

Paramaters (including the detector type) are drawn from the GVars database. The parameter "detector" determines the detector type. Valid options are:

Definition at line 156 of file detectors.cc.

Referenced by mmain().

00157 {
00158     
00159     string d = GV3::get<string>("detector", "fast9", 1);
00160     
00161     if(d == "random")
00162         return auto_ptr<DetectN>(new Random);
00163     else if(d == "dog")
00164         return auto_ptr<DetectN>(new dog);
00165     else if(d == "harrisdog")
00166         return auto_ptr<DetectN>(new harrisdog);
00167     else if(d == "shitomasi")
00168         return auto_ptr<DetectN>(new ShiTomasiDetect);
00169     else if(d == "harris")
00170         return auto_ptr<DetectN>(new HarrisDetect);
00171     #ifdef USESUSAN
00172         else if(d == "susan")
00173             return auto_ptr<DetectN>(new SearchThreshold(new SUSAN));
00174     #endif
00175     else if(d == "fast9")
00176         return auto_ptr<DetectN>(new SearchThreshold(new fast_9));
00177     else if(d == "fast9old")
00178         return auto_ptr<DetectN>(new SearchThreshold(new fast_9_old));
00179     else if(d == "fast12")
00180         return auto_ptr<DetectN>(new SearchThreshold(new fast_12));
00181     else if(d == "faster2")
00182         return auto_ptr<DetectN>(new SearchThreshold(new faster_learn(GV3::get<string>("faster2"))));
00183     else
00184     {
00185         cerr << "Unknown detector: " << d << endl;
00186         exit(1);
00187     }
00188 }

void HarrisDetector ( const CVD::Image< float > &  i,
std::vector< std::pair< float, CVD::ImageRef > > &  c,
unsigned int  N,
float  blur,
float  sigmas 
)

Detect Harris corners.

Parameters:
i Image in which to detect corners
c Detected corners and strengths are inserted in to this container
N Number of corners to detect
blur Standard deviation of blur to use
sigmas Blur using sigmas standard deviations

Referenced by harrisdog::operator()().


Generated on Mon Mar 2 12:47:12 2009 for FAST-ER by  doxygen 1.5.3