Example for usage of CornerDetector Usage: ExampleCornerDetector [parameter] <im1> <im2> [ <im3> ... ]
#include <bias_config.h>
#include <FeatureDetector/CornerDetectorFoerstner.hh>
#include <FeatureDetector/CornerDetectorHarris.hh>
#include <FeatureDetector/CornerDetectorSusan.hh>
#include <FeatureDetector/CornerDetectorKLT.hh>
#include <FeatureDetector/LinearRegionDetector.hh>
#include <Base/Image/ColourRGB.hh>
#include <Base/ImageUtils/ImageDraw.hh>
#include <Base/Image/ImageConvert.hh>
#include <Base/Image/ImageIO.hh>
using namespace BIAS;
using namespace std;
#define type 1
#if type == 0
#ifdef BUILD_IMAGE_INT
#define StorageType unsigned char
#define KernelType int
#else
#define StorageType unsigned char
#define KernelType float
#endif
#elif type == 1
#define StorageType float
#define KernelType float
#endif
{
const int nump=p.size();
unsigned start[2];
unsigned radius=10;
for (int l=0; l<nump; l++){
if (!p[l].IsAtInfinity()){
start[0]=(unsigned)rint(p[l][0]);
start[1]=(unsigned)rint(p[l][1]);
radius, col);
}
}
}
int main(int argc, char *argv[])
{
#if type ==1
#endif
#if type == 0
#endif
vector<HomgPoint2D> p;
vector<QUAL> qual;
int argind = 1;
if (argc-argind<1 || argind<1){
cerr << argv[0] << " [parameter] <im1> <im2> [ <im3> ... ] \n";
return -2;
}
switch (cdt){
#if type == 0
cd = &cds;
#else
BIASERR("susan only implemented for unsigned char");
#endif
break;
cd = &cdklt;
cout << "corner detector klt has been chosen " << endl;
#if type ==1
cdg = &cdklt;
#endif
break;
cd = &cdh;
cout << "corner detector harris has been chosen " << endl;
#if type == 1
cdg = &cdh;
#endif
break;
cd = &cdf;
#if type == 1
cdg = &cdf;
#endif
break;
default:
BIASERR("unknown corner detector type");
BIASABORT
break;
}
bool WantLinearRegionDetector = false;
if (WantLinearRegionDetector) {
cout << "CornerDetector not used, detecting LINEAR regions ..."<<endl;
cd = &cdl;
}
for (int i=argind; i<argc; i++){
#if type == 0
#else
#endif
BIASERR("error loading image "<<argv[i]);
return -1;
} else {
cerr << "read "<<argv[i]<<endl;
}
#if type == 0
im = tempimage;
#else
ucim = tempimage;
#endif
#if type != 0
BIASERR("error converting image "<<argv[i]);
}
#endif
#if type == 0
if (cd->
Detect(im, p, qual)!=0) {
cerr<<"Corner detector indicated an error !"<<endl;
}
#endif
#if type == 1
if (cdg->
Detect(im, p, qual)!=0) {
cerr<<"Corner detector indicated an error !"<<endl;
}
#endif
cerr << "found "<<p.size()<<" corners"<<endl;
for (unsigned int r=0; r<p.size(); r++) {
cout <<setw(5)<<r<<" : "<<p[r]<<" with quality "<<qual[r]<<endl;
}
#if type == 0
#else
#endif
Draw(rgbim, p);
ostringstream name;
name << "corners-"<<setw(4)<<setfill('0')<<i-argind<<".mip";
}
return 0;
}