From: <ste...@us...> - 2007-08-23 22:09:35
|
Revision: 2419 http://hugin.svn.sourceforge.net/hugin/?rev=2419&view=rev Author: stereo_sl Date: 2007-08-23 15:09:28 -0700 (Thu, 23 Aug 2007) Log Message: ----------- - fixed issues with vigra - RGB image is now converted to grayscale - fixed issues with vector capacity(vector with control points) Modified Paths: -------------- gsoc07_featuredetection/Descriptor.cpp gsoc07_featuredetection/FeatureMatcher.cpp gsoc07_featuredetection/FeatureMatcher.h gsoc07_featuredetection/FeatureMatching.cpp gsoc07_featuredetection/HessianDetector.cpp gsoc07_featuredetection/HessianDetector.h gsoc07_featuredetection/Image.cpp Modified: gsoc07_featuredetection/Descriptor.cpp =================================================================== --- gsoc07_featuredetection/Descriptor.cpp 2007-08-23 16:10:50 UTC (rev 2418) +++ gsoc07_featuredetection/Descriptor.cpp 2007-08-23 22:09:28 UTC (rev 2419) @@ -177,13 +177,13 @@ } double Descriptor::_gaussWeighting(int x, int y, double stdev) { - return (1/(2*PI*pow(stdev,2)))*exp(-(pow(x,2)+pow(y,2))/(2*stdev)); +return (1/(2*PI*pow(stdev,2.0)))*exp(-(pow((double)x,2.0)+pow((double)y,2.0))/(2*stdev)); } double Descriptor::_getMaxima(int x,int y) { return this->hd->getMaxima(x,y); } double Descriptor::_euclidianDistance(int x1, int y1, int x2, int y2) { - return sqrt(pow(x1-x2,2)+pow(y1-y2,2)); + return sqrt(pow((double)(x1-x2),2.0)+pow((double)(y1-y2),2.0)); } void Descriptor::_GaborResponse(int x,int y, double maxima, double* descriptor) { // @@ -201,346 +201,346 @@ //relative coordinates(from the center of the kernel) and weights //for points of local maxima for first gabor filter(x,y,weight) double gabor11[6][3]={ - -1,0,0.839304, - 1,0,-0.839304, - -3,0,-0.190826, - 3,0,0.190826, - -6,0,0.0105653, - 6,0,-0.0105653 + {-1,0,0.839304}, + {1,0,-0.839304}, + {-3,0,-0.190826}, + {3,0,0.190826}, + {-6,0,0.0105653}, + {6,0,-0.0105653} }; //second...orientation=0, wavelength=10 double gabor12[6][3]={ - -2,0,0.839304, - 2,0,-0.839304, - -7,0,-0.20568, - 7,0,0.20568, - -11,0,0.0133981, - 11,0,-0.0133981 + {-2,0,0.839304}, + {2,0,-0.839304}, + {-7,0,-0.20568}, + {7,0,0.20568}, + {-11,0,0.0133981}, + {11,0,-0.0133981} }; double gabor13[10][3]={ - -2,0,0.945959, - 2,0,-0.945959, - -6,0,-0.606531, - 6,0,0.606531, - -10,0,0.249352, - 10,0,-0.249352, - -13,0,0.0676238, - 13,0,-0.0676238, - -17,0,0.0127725, - 17,0,-0.0127725 + {-2,0,0.945959}, + {2,0,-0.945959}, + {-6,0,-0.606531}, + {6,0,0.606531}, + {-10,0,0.249352}, + {10,0,-0.249352}, + {-13,0,0.0676238}, + {13,0,-0.0676238}, + {-17,0,0.0127725}, + {17,0,-0.0127725} }; //orientation=PI/4, wavelength=5 double gabor21[6][3]={ - -1,-1,0.762278, - -3,-2,-0.201919, - 2,3,0.201919, - 1,1,0.762278, - 3,5,0.0134254, - -5,-3,-0.0134254 + {-1,-1,0.762278}, + {-3,-2,-0.201919}, + {2,3,0.201919}, + {1,1,0.762278}, + {3,5,0.0134254}, + {-5,-3,-0.0134254} }; //orientation=PI/4, wavelength=10 double gabor22[6][3]={ - -2,-1,0.844207, - 2,1,-0.844207, - -5,-4,-0.213173, - 5,4,0.213173, - -9,-7,0.013459, - 9,7,-0.013459 + {-2,-1,0.844207}, + {2,1,-0.844207}, + {-5,-4,-0.213173}, + {5,4,0.213173}, + {-9,-7,0.013459}, + {9,7,-0.013459} }; double gabor23[10][3]={ - -2,-1,0.935087, - 2,1,-0.935087, - -4,-4,-0.618035, - 4,4,0.618035, - -7,-7,0.255577, - 7,7,-0.255577, - -9,-10,-0.0736175, - 10,9,0.0736175, - -12,-12,0.0126482, - 12,12,-0.0126482 + {-2,-1,0.935087}, + {2,1,-0.935087}, + {-4,-4,-0.618035}, + {4,4,0.618035}, + {-7,-7,0.255577}, + {7,7,-0.255577}, + {-9,-10,-0.0736175}, + {10,9,0.0736175}, + {-12,-12,0.0126482}, + {12,12,-0.0126482} }; double gabor31[6][3]={ - 0,-1,0.839304, - 0,1,-0.839304, - 0,-3,-0.190826, - 0,3,0.190826, - 0,6,-0.0105653, - 0,-6,0.0105653 + {0,-1,0.839304}, + {0,1,-0.839304}, + {0,-3,-0.190826}, + {0,3,0.190826}, + {0,6,-0.0105653}, + {0,-6,0.0105653} }; double gabor32[6][3]={ - 0,2,-0.839304, - 0,7,0.20568, - 0,11,-0.0133981, - 0,-2,0.839304, - 0,-7,-0.20568, - 0,-11,0.0133981 + {0,2,-0.839304}, + {0,7,0.20568}, + {0,11,-0.0133981}, + {0,-2,0.839304}, + {0,-7,-0.20568}, + {0,-11,0.0133981} }; double gabor33[10][3]={ - 0,-2,0.945959, - 0,2,-0.945959, - 0,-6,-0.606531, - 0,6,0.606531, - 0,-10,0.249352, - 0,10,-0.249352, - 0,-13,-0.0676238, - 0,13,0.0676238, - 0,-17,-0.0127725, - 0,17,0.0127725 + {0,-2,0.945959}, + {0,2,-0.945959}, + {0,-6,-0.606531}, + {0,6,0.606531}, + {0,-10,0.249352}, + {0,10,-0.249352}, + {0,-13,-0.0676238}, + {0,13,0.0676238}, + {0,-17,-0.0127725}, + {0,17,0.0127725} }; double gabor41[6][3]={ - 1,-1,0.762278, - -2,+3,0.201919, - 2,-3,-0.201919, - -1,1,-0.762278, - 3,-5,0.0134254, - -3,5,-0.0134254 + {1,-1,0.762278}, + {-2,+3,0.201919}, + {2,-3,-0.201919}, + {-1,1,-0.762278}, + {3,-5,0.0134254}, + {-3,5,-0.0134254} }; double gabor42[6][3]={ - -1,2,-0.844207, - 2,-1,0.844207, - 4,-5,-0.213173, - -5,4,0.213173, - 8,-8,0.013459, - -8,8,-0.013459 + {-1,2,-0.844207}, + {2,-1,0.844207}, + {4,-5,-0.213173}, + {-5,4,0.213173}, + {8,-8,0.013459}, + {-8,8,-0.013459} }; double gabor43[10][3]={ - 2,-1,0.935087, - -1,2,-0.935087, - 4,-4,-0.618035, - -4,4,0.618035, - 7,-7,0.255577, - -7,7,-0.255577, - 9,-10,-0.0736175, - -10,9,0.0736175, - 12,-12,0.0126482, - -12,12,-0.0126482 + {2,-1,0.935087}, + {-1,2,-0.935087}, + {4,-4,-0.618035}, + {-4,4,0.618035}, + {7,-7,0.255577}, + {-7,7,-0.255577}, + {9,-10,-0.0736175}, + {-10,9,0.0736175}, + {12,-12,0.0126482}, + {-12,12,-0.0126482} }; //orientation PI/8 double gabor53[10][3]={ - -2,0,0.946801, - 2,0,-0.946801, - -5,-3,-0.619484, - 3,5,0.619484, - -7,-8,0.263348, - 8,7,-0.263348, - -12,-6,0.0735327, - 6,12,-0.0735327, - -15,-9,0.0133379, - 9,15,-0.0133379 + {-2,0,0.946801}, + {2,0,-0.946801}, + {-5,-3,-0.619484}, + {3,5,0.619484}, + {-7,-8,0.263348}, + {8,7,-0.263348}, + {-12,-6,0.0735327}, + {6,12,-0.0735327}, + {-15,-9,0.0133379}, + {9,15,-0.0133379} }; //orientation 3*(PI/8) double gabor63[10][3]={ - 0,-2,0.946801, - 0,2,-0.946801, - -3,-5,-0.619484, - 5,3,0.619484, - -8,-7,0.263348, - 7,8,-0.263348, - -6,-12,0.0735327, - 12,6,-0.0735327, - -9,-15,0.0133379, - 15,9,-0.0133379 + {0,-2,0.946801}, + {0,2,-0.946801}, + {-3,-5,-0.619484}, + {5,3,0.619484}, + {-8,-7,0.263348}, + {7,8,-0.263348}, + {-6,-12,0.0735327}, + {12,6,-0.0735327}, + {-9,-15,0.0133379}, + {15,9,-0.0133379} }; //orientation 5*PI/8 double gabor73[10][3]={ - 0,-2,0.946801, - 0,2,-0.946801, - 3,-5,-0.619484, - -3,5,0.619484, - 8,-7,0.263348, - -8,8,-0.263348, - 6,-12,0.0735327, - -6,12,-0.0735327, - 9,-15,0.0133379, - -9,15,-0.0133379 + {0,-2,0.946801}, + {0,2,-0.946801}, + {3,-5,-0.619484}, + {-3,5,0.619484}, + {8,-7,0.263348}, + {-8,8,-0.263348}, + {6,-12,0.0735327}, + {-6,12,-0.0735327}, + {9,-15,0.0133379}, + {-9,15,-0.0133379} }; //orientation 7*PI/8 double gabor83[10][3]={ - 2,0,0.946801, - -2,0,-0.946801, - 5,-3,-0.619484, - -5,3,0.619484, - 7,-8,0.263348, - -7,8,-0.263348, - 12,-6,0.0735327, - -12,6,-0.0735327, - 15,-9,0.0133379, - -15,9,-0.0133379 + {2,0,0.946801}, + {-2,0,-0.946801}, + {5,-3,-0.619484}, + {-5,3,0.619484}, + {7,-8,0.263348}, + {-7,8,-0.263348}, + {12,-6,0.0735327}, + {-12,6,-0.0735327}, + {15,-9,0.0133379}, + {-15,9,-0.0133379} }; //stdev=6, wavelength=4, phase=0, orientation=0 double gabor91[17][3]={ - -16,0, 0.0285655, - -14,0, -0.0657285, - -12,0, 0.135335, - -10,0, -0.249352, - -8,0, 0.411112, - -6,0, -0.606531, - -4,0, 0.800737, - -2,0, -0.945959, - 0,0, 1, - 16,0, 0.0285655, - 14,0, -0.0657285, - 12,0, 0.135335, - 10,0, -0.249352, - 8,0, 0.411112, - 6,0, -0.606531, - 4,0, 0.800737, - 2,0, -0.945959 + {-16,0, 0.0285655}, + {-14,0, -0.0657285}, + {-12,0, 0.135335}, + {-10,0, -0.249352}, + {-8,0, 0.411112}, + {-6,0, -0.606531}, + {-4,0, 0.800737}, + {-2,0, -0.945959}, + {0,0, 1}, + {16,0, 0.0285655}, + {14,0, -0.0657285}, + {12,0, 0.135335}, + {10,0, -0.249352}, + {8,0, 0.411112}, + {6,0, -0.606531}, + {4,0, 0.800737}, + {2,0, -0.945959} }; //stdev=6, wavelength=4, phase=0, orientation=PI/8 double gabor101[17][3]={ - -16,-3,0.0292416, - -14,-2, -0.0656082, - -12,-2, 0.138167, - -10,-2, -0.248923, - -8,-1, 0.404746, - -6,-1, -0.609707, - -4,-1, 0.787721, - -2,0, -0.926472, - 0,0, 1, - 16,3,0.0292416, - 14,2, -0.0656082, - 12,2, 0.138167, - 10,2, -0.248923, - 8,1, 0.404746, - 6,1, -0.609707, - 4,1, 0.787721, - 2,0, -0.926472, + {-16,-3,0.0292416}, + {-14,-2, -0.0656082}, + {-12,-2, 0.138167}, + {-10,-2, -0.248923}, + {-8,-1, 0.404746}, + {-6,-1, -0.609707}, + {-4,-1, 0.787721}, + {-2,0, -0.926472}, + {0,0, 1}, + {16,3,0.0292416}, + {14,2, -0.0656082}, + {12,2, 0.138167}, + {10,2, -0.248923}, + {8,1, 0.404746}, + {6,1, -0.609707}, + {4,1, 0.787721}, + {2,0, -0.926472} }; //stdev=6, wavelength=4, phase=0, orientation=PI/4 double gabor111[17][3]={ - -11,-11, 0.026607, - -10,-10, -0.0606333, - -9,-8, 0.134318, - -7,-7, -0.253187, - -6,-5, 0.405626, - -4,-4, -0.550271, - -3,-3, 0.722915, - -2,-1, -0.922342, - 0,0, 1, - 11,11, 0.026607, - 10,10, -0.0606333, - 8,9, 0.134318, - 7,7, -0.253187, - 5,6, 0.405626, - 4,4, -0.550271, - 3,3, 0.722915, - 1,2, -0.922342 + {-11,-11, 0.026607}, + {-10,-10, -0.0606333}, + {-9,-8, 0.134318}, + {-7,-7, -0.253187}, + {-6,-5, 0.405626}, + {-4,-4, -0.550271}, + {-3,-3, 0.722915}, + {-2,-1, -0.922342}, + {0,0, 1}, + {11,11, 0.026607}, + {10,10, -0.0606333}, + {8,9, 0.134318}, + {7,7, -0.253187}, + {5,6, 0.405626}, + {4,4, -0.550271}, + {3,3, 0.722915}, + {1,2, -0.922342} }; //3PI/8 double gabor121[17][3]={ - -5,-15, 0.0295778, - -5,-13, -0.0672137, - -2,-12, 0.138167, - -4,-9, -0.252577, - -1,-8, 0.404746, - -3,-5, -0.588397, - -1,-4, 0.787721, - -0,-2, -0.926472, - 0,0, 1, - 5,15, 0.0295778, - 5,13, -0.0672137, - 2,12, 0.138167, - 4,9, -0.252577, - 1,8, 0.404746, - 3,5, -0.588397, - 1,4, 0.787721, - 0,2, -0.926472 + {-5,-15, 0.0295778}, + {-5,-13, -0.0672137}, + {-2,-12, 0.138167}, + {-4,-9, -0.252577}, + {-1,-8, 0.404746}, + {-3,-5, -0.588397}, + {-1,-4, 0.787721}, + {-0,-2, -0.926472}, + {0,0, 1}, + {5,15, 0.0295778}, + {5,13, -0.0672137}, + {2,12, 0.138167}, + {4,9, -0.252577}, + {1,8, 0.404746}, + {3,5, -0.588397}, + {1,4, 0.787721}, + {0,2, -0.926472} }; double gabor131[17][3]={ - 0,-16, 0.0285655, - 0,-14, -0.0657285, - 0,-12, 0.135335, - 0,-10, -0.249352, - 0,-8, 0.411112, - 0,-6, -0.606531, - 0,-4, 0.800737, - 0,-2, -0.945959, - 0,0, 1, - 0,16, 0.0285655, - 0,14, -0.0657285, - 0,12, 0.135335, - 0,10, -0.249352, - 0,8, 0.411112, - 0,6, -0.606531, - 0,4, 0.800737, - 0,2, -0.945959 + {0,-16, 0.0285655}, + {0,-14, -0.0657285}, + {0,-12, 0.135335}, + {0,-10, -0.249352}, + {0,-8, 0.411112}, + {0,-6, -0.606531}, + {0,-4, 0.800737}, + {0,-2, -0.945959}, + {0,0, 1}, + {0,16, 0.0285655}, + {0,14, -0.0657285}, + {0,12, 0.135335}, + {0,10, -0.249352}, + {0,8, 0.411112}, + {0,6, -0.606531}, + {0,4, 0.800737}, + {0,2, -0.945959} }; //5PI/8 double gabor141[17][3]={ - 10,-13, 0.0296244, - 5,-14, -0.0672137, - 7,-10, 0.137794, - 4,-9, -0.252577, - 6,-6, 0.411811, - 1,-6, -0.606531, - 3,-3, 0.801129, - 3,-1, -0.93537, - 0,0, 1, - -10,13, 0.0296244, - -5,14, -0.0672137, - -7,10, 0.137794, - -4,9, -0.252577, - -6,6, 0.411811, - -1,6, -0.606531, - -3,-3, 0.801129, - -3,1, -0.93537 + {10,-13, 0.0296244}, + {5,-14, -0.0672137}, + {7,-10, 0.137794}, + {4,-9, -0.252577}, + {6,-6, 0.411811}, + {1,-6, -0.606531}, + {3,-3, 0.801129}, + {3,-1, -0.93537}, + {0,0, 1}, + {-10,13, 0.0296244}, + {-5,14, -0.0672137}, + {-7,10, 0.137794}, + {-4,9, -0.252577}, + {-6,6, 0.411811}, + {-1,6, -0.606531}, + {-3,-3, 0.801129}, + {-3,1, -0.93537} }; //6PI/8 double gabor151[17][3]={ - 11,-11, 0.026607, - 10,-10, -0.0606333, - 9,-8, 0.134318, - 7,-7, -0.253187, - 6,-5, 0.405626, - 4,-4, -0.550271, - 3,-3, 0.722915, - 2,-1, -0.922342, - 0,0, 1, - -11,11, 0.026607, - -10,10, -0.0606333, - -8,9, 0.134318, - -7,7, -0.253187, - -5,6, 0.405626, - -4,4, -0.550271, - -3,3, 0.722915, - -1,2, -0.922342 + {11,-11, 0.026607}, + {10,-10, -0.0606333}, + {9,-8, 0.134318}, + {7,-7, -0.253187}, + {6,-5, 0.405626}, + {4,-4, -0.550271}, + {3,-3, 0.722915}, + {2,-1, -0.922342}, + {0,0, 1}, + {-11,11, 0.026607}, + {-10,10, -0.0606333}, + {-8,9, 0.134318}, + {-7,7, -0.253187}, + {-5,6, 0.405626}, + {-4,4, -0.550271}, + {-3,3, 0.722915}, + {-1,2, -0.922342} }; double gabor161[17][3] = { - 15,-5, 0.0295778, - 13,-5, -0.0672137, - 12,-2, 0.138167, - 9,-4, -0.252577, - 8,-1, 0.404746, - 5,-3, -0.588397, - 4,-1, 0.787721, - 0,-2, -0.926472, - 0,0, 1, - -15,5, 0.0295778, - -13,5, -0.0672137, - -12,2, 0.138167, - -9,4, -0.252577, - -8,1, 0.404746, - -5,3, -0.588397, - -4,1, 0.787721, - -2,0, -0.926472 + {15,-5, 0.0295778}, + {13,-5, -0.0672137}, + {12,-2, 0.138167}, + {9,-4, -0.252577}, + {8,-1, 0.404746}, + {5,-3, -0.588397}, + {4,-1, 0.787721}, + {0,-2, -0.926472}, + {0,0, 1}, + {-15,5, 0.0295778}, + {-13,5, -0.0672137}, + {-12,2, 0.138167}, + {-9,4, -0.252577}, + {-8,1, 0.404746}, + {-5,3, -0.588397}, + {-4,1, 0.787721}, + {-2,0, -0.926472} }; @@ -706,6 +706,7 @@ } bool Descriptor::generateAutopanoXML(string name) { + cout << "Generating XML file: "<<name<<endl; ofstream xmlFile (name.c_str()); if (xmlFile.is_open()) { Modified: gsoc07_featuredetection/FeatureMatcher.cpp =================================================================== --- gsoc07_featuredetection/FeatureMatcher.cpp 2007-08-23 16:10:50 UTC (rev 2418) +++ gsoc07_featuredetection/FeatureMatcher.cpp 2007-08-23 22:09:28 UTC (rev 2419) @@ -30,6 +30,12 @@ this->descriptor2 = d2; this->matchingType = mt; this->nrControlPoints = nrCP; + + vector<int> point; + point.resize(2); + + this->controlPoints.reserve(sizeof(point)*this->nrControlPoints); + } void FeatureMatcher::match(double threshold) { @@ -39,6 +45,7 @@ vector<vector<double> >* descriptors2=this->descriptor2->getDescriptors(); int pointCount=0; + int cpCount=0; //matched points counter int max; int maxId; //position int the vector of the nearest neighbour @@ -78,17 +85,18 @@ if(diff<(threshold*diff2)) { controlPoint.clear(); - controlPoint.push_back((*this->descriptor2->interestPoints)[maxId][0]); controlPoint.push_back((*this->descriptor2->interestPoints)[maxId][1]); controlPoint.push_back((*this->descriptor1->interestPoints)[pointCount][0]); controlPoint.push_back((*this->descriptor1->interestPoints)[pointCount][1]); this->controlPoints.push_back(controlPoint); + cpCount++; } iter1++; pointCount++; } + this->nrControlPoints = cpCount; } /*void FeatureMatcher::printCtrlPoints() { vector<vector<int> >::iterator iter1 = this->controlPoints.begin(); @@ -102,6 +110,10 @@ vector<vector<int> > FeatureMatcher::getCtrlPoints() { return this->controlPoints; } +int FeatureMatcher::getNrPoints() { + return this->nrControlPoints; +} + double FeatureMatcher::_getDistance(vector<double>* d1,vector<double>* d2) { double dist=0; for(int i=0; i<DESCRIPTOR_SIZE;i++) { Modified: gsoc07_featuredetection/FeatureMatcher.h =================================================================== --- gsoc07_featuredetection/FeatureMatcher.h 2007-08-23 16:10:50 UTC (rev 2418) +++ gsoc07_featuredetection/FeatureMatcher.h 2007-08-23 22:09:28 UTC (rev 2419) @@ -34,6 +34,7 @@ void match(double threshold=0.7); //void addDescriptor(Descriptor* descriptor) vector<vector<int> > getCtrlPoints(); + int getNrPoints(); //void printCtrlPoints(); //void setPoints(vector<vector<double> >* desc); Modified: gsoc07_featuredetection/FeatureMatching.cpp =================================================================== --- gsoc07_featuredetection/FeatureMatching.cpp 2007-08-23 16:10:50 UTC (rev 2418) +++ gsoc07_featuredetection/FeatureMatching.cpp 2007-08-23 22:09:28 UTC (rev 2419) @@ -70,7 +70,7 @@ string input2; bool generateXML=false; - int nrPoints = 1000; + int nrPoints = 4000; // parse arguments while ((c = getopt (argc, argv, optstring)) != -1) @@ -129,7 +129,8 @@ return 1; } //print points and display image with the detected points(debugging only) - //hd1.printPoints(); + /*hd1.printPoints(); + return 0;*/ finish = clock(); @@ -161,22 +162,33 @@ cout << "Matching..."<<endl; - FeatureMatcher fm(20, &d1, &d2, FM_SECOND_NN); + FeatureMatcher fm(nrPoints, &d1, &d2, FM_SECOND_NN); fm.match(0.5); - vector<vector<int> > cps=fm.getCtrlPoints(); + + vector<int> point; + point.resize(4); + + vector<vector<int> > cps; + cps.reserve(sizeof(point)*fm.getNrPoints()); + cps=fm.getCtrlPoints(); + cout << "...matching ended." << endl; int size = cps.size(); cout << "Nr of control points:"<< size <<endl; - cout << "Control points("; - cout << "x1\ty1\t:\tx2\ty2):"<<endl; + cout << "Control points:"<<endl; + cout << "(x1\ty1\t:\tx2\ty2)"<<endl; + vector<vector<int> >::iterator iter1 =cps.begin(); - for(int i=0; i<size; i++) { - cout << cps[i][0] << "\t" << cps[i][1] << "\t" << ":" << "\t" << cps[i][2] << "\t" << cps[i][3] << endl ; - im1.drawCircle(cps[i][3],cps[i][2],10); - im2.drawCircle(cps[i][1],cps[i][0],10); - } + while( iter1 != cps.end()) { + vector<int> current = *iter1; + cout << current[0] << "\t" << current[1] << "\t" << ":" << "\t" << current[2] << "\t" << current[3] << endl ; + im1.drawCircle(current[2],current[3],10); + im2.drawCircle(current[0],current[1],10); + iter1++; + } + im1.show(); im2.show(); } Modified: gsoc07_featuredetection/HessianDetector.cpp =================================================================== --- gsoc07_featuredetection/HessianDetector.cpp 2007-08-23 16:10:50 UTC (rev 2418) +++ gsoc07_featuredetection/HessianDetector.cpp 2007-08-23 22:09:28 UTC (rev 2419) @@ -230,7 +230,7 @@ int width = this->image->getWidthBW(); cout << "Height:"<<height << ",width:"<<width<<endl; - cout << "Max vector size:"<< orderedList.max_size() << ", capacity:" << orderedList.capacity() << "\n"; + //cout << "Max vector size:"<< orderedList.max_size() << ", capacity:" << orderedList.capacity() << "\n"; const int iMax=std::numeric_limits<int>::max(); @@ -252,8 +252,6 @@ } } - cout << "calculated maximas"<< "\n"; - vector<vector<int> >::iterator it; it = orderedList.begin(); Modified: gsoc07_featuredetection/HessianDetector.h =================================================================== --- gsoc07_featuredetection/HessianDetector.h 2007-08-23 16:10:50 UTC (rev 2418) +++ gsoc07_featuredetection/HessianDetector.h 2007-08-23 22:09:28 UTC (rev 2419) @@ -58,9 +58,9 @@ int nrPoints; int nrOctaves; CONVOLUTION_TYPE convolutionType; - vector<vector<int> > determinants; //holds the values of the hessian determinant for each pixel - vector<vector<int> > orderedList; //first n pixels with the largest determinant values - vector<vector<double> > maximas; //holds the scales where scale-space representation for each pixel attends maximum + std::vector<vector<int> > determinants; //holds the values of the hessian determinant for each pixel + std::vector<vector<int> > orderedList; //first n pixels with the largest determinant values + std::vector<vector<double> > maximas; //holds the scales where scale-space representation for each pixel attends maximum int _getHessianDeterminant(int* pixelSumXX, int* pixelSumXY, int *pixelSumYY); void _calculateMaxDet(int i, int j); //calculates scale-space maxima for pixel at coord i,j Modified: gsoc07_featuredetection/Image.cpp =================================================================== --- gsoc07_featuredetection/Image.cpp 2007-08-23 16:10:50 UTC (rev 2418) +++ gsoc07_featuredetection/Image.cpp 2007-08-23 22:09:28 UTC (rev 2419) @@ -50,37 +50,46 @@ else { - //BRGBImage in(info.width(), info.height()); + BRGBImage in(info.width(), info.height()); + //TODO: this does not work. How to make a conversion from RGB to BW image in vigra??? this->imgBW=new BImage(info.width(), info.height()); - importImage(info, destImage(*this->imgBW)); + importImage(info, destImage(in)); + // create image iterator that points to upper left corner + // of source image + vigra::BRGBImage::Iterator sy = in.upperLeft(); - //copyImage(srcImageRange(in), destImage(*this->imgBW)); + // create image iterator that points past the lower right corner of + // source image (similarly to the past-the-end iterator in the STL) + vigra::BRGBImage::Iterator send = in.lowerRight(); - /*if(strcmp("test.jpg", "-") == 0) - { - // write stdout - exportImage(srcImageRange(out), + // create image iterator that points to upper left corner + // of destination image + vigra::BImage::Iterator dy = (*this->imgBW).upperLeft(); - vigra::ImageExportInfo("test.jpg").setFileType(info.getFileType())); - } - else + // iterate down the first column of the images + for(; sy.y != send.y; ++sy.y, ++dy.y) { - exportImage(srcImageRange(in), vigra::ImageExportInfo("test.jpg")); - }*/ + // create image iterator that points to the first + // pixel of the current row of the source image + vigra::BRGBImage::Iterator sx = sy; - // create a RGB image of appropriate size - //vigra::BRGBImage in(info.width(), info.height()); + // create image iterator that points to the first + // pixel of the current row of the destination image + vigra::BImage::Iterator dx = dy; - //this->imageBW(info.width(), info.height()); - // import the image just read - // importImage(info, destImage(imageRGB)); - //importImage(info, destImage(this->imageBW)); - // write the image to the file given as second argument - // the file type will be determined from the file name's extension - //exportImage(srcImageRange(this->imageRGB), vigra::ImageExportInfo("aaa.jpg"));*/ + // iterate across current row + for(; sx.x != send.x; ++sx.x, ++dx.x) + { + RGBValue<int,0u,1u,2u> pixel = *sx; + // calculate grayscale value + // Y = 0.3*R + 0.59*G + 0.11*B + *dx = vigra::round(0.3*pixel.red() + 0.59*pixel.green() + 0.11*pixel.blue()); + } + } + //exportImage(srcImageRange(*this->imgBW), vigra::ImageExportInfo("ttt.jpg")); } return true; } @@ -241,9 +250,6 @@ } //cout << "\n"; } - cout << "EOF integration\n"; - - } int Image::_getValue4Integral(int x, int y) { if(x==-1 || y==-1) return 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |