Jafar
|
00001 #ifndef _FDETECT_HARRIS_DETECTOR_HPP_ 00002 #define _FDETECT_HARRIS_DETECTOR_HPP_ 00003 00004 #include <list> 00005 00006 #include <image/Image.hpp> 00007 #include "image/roi.hpp" 00008 00009 #include "fdetect/Detector.hpp" 00010 #include "fdetect/Descriptor.hpp" 00011 #include "fdetect/InterestFeature.hpp" 00012 #include "fdetect/HarrisDescriptor.hpp" 00013 00014 namespace jafar { 00015 namespace fdetect { 00016 00022 class HarrisDetector : public Detector { 00023 public: 00024 enum Cornerness {HS_HARRIS, HS_EIGEN} ; 00025 public: 00040 HarrisDetector(float scale_factor = 1.0, float derivationSigma = 1.0, float convolutionSigma = 2.0, jafar::fdetect::HarrisDetector::Cornerness cornerness = HS_EIGEN, float threshold = 0.0, bool fixnumber = true, int desirednum = 1000); 00041 public: 00042 virtual jafar::fdetect::DetectionResult detectIn(jafar::image::Image const& image); 00043 virtual bool detectBestPntInRoi(jafar::image::Image const& image, 00044 InterestFeature * featPtr, const jafar::image::ROI * roiPtr = 0 ); 00045 public: 00046 // inline double scaleFactor() { return m_scale_factor; } 00047 float scaleFactor() const; 00048 float derivationSigma() const; 00049 float convolutionSigma() const; 00050 float threshold() const; 00051 Cornerness cornerness() const; 00052 int desiredNumber() const; 00053 int derivationSize() const; 00054 int convolutionSize() const; 00055 bool isFixNumber() const; 00056 00057 private: 00058 void gaussianDerivativesSA(jafar::image::Image const& image); 00059 void gaussianDerivatives(jafar::image::Image const& image); 00060 void gaussianDerivatives(jafar::image::Image const& image, const jafar::image::ROI & roi); 00061 void gaussianConvolutionSA(jafar::image::Image const& image); 00062 void gaussianConvolution(jafar::image::Image const& image); 00063 void gaussianConvolution(jafar::image::Image const& image, const jafar::image::ROI & roi); 00064 void computeHarrisCurvature (jafar::image::Image const& image); 00065 void computeEigenCurvature (jafar::image::Image const& image); 00066 void computeEigenCurvatureWithMax (jafar::image::Image const& image, int pixMax[2], float * scoreMax); 00067 void cornerCharacteristics(DetectionResult& points, jafar::image::Image const& image); 00068 // void cornerCharacteristicsSA(vInterestFeatures& points, jafar::image::Image const& image); 00069 template<bool autoThreshold, bool useScale> 00070 DetectionResult extractCorners (jafar::image::Image const& image); 00071 private: 00072 float m_scale_factor, m_derivationSigma, m_convolutionSigma, m_threshold; 00073 Cornerness m_cornerness; 00074 int m_desirednum, m_derivationSize, m_convolutionSize; 00075 bool m_fixnumber; 00076 struct HData { 00077 float im_x, im_y, im_xx, im_xy, im_yy, im_conv_xx, im_conv_xy, im_conv_yy, im_high_curv, im_low_curv; 00078 }; 00079 HData* m_data; 00080 }; 00081 00082 template<bool autoThreshold, bool useScale> 00083 DetectionResult HarrisDetector::extractCorners (jafar::image::Image const& image) 00084 { 00085 struct Corner { 00086 Corner(float* ihc, float pc) : im_high_corner(ihc), pix_center(pc) { } 00087 float* im_high_corner; 00088 float pix_center; 00089 }; 00090 00091 int nblig = image.height(); 00092 int nbcol = image.width(); 00093 00094 // Variables used when autoThreshold = true 00095 unsigned int d_number; // nimber of points 00096 std::list<InterestFeature*> lcorners; // corners list 00097 DetectionResult vcorners; 00098 00099 /* Cornerness Type */ 00100 // switch (params->cornernessType) { 00101 // case HS_HARRIS: 00102 // pix_center_org = data->im_high_curv; 00103 // pix_center_org1 = data->im_low_curv; 00104 // break; 00105 // case HS_EIGEN: 00106 // pix_center_org = data->im_low_curv; 00107 // pix_center_org1 = data->im_high_curv; 00108 // break; 00109 // default: 00110 // JFR_PRECOND(false,"ERR_HS_BAD_PARAM"); 00111 // } 00112 00113 if(autoThreshold) 00114 { 00115 if( m_desirednum == -1) { 00116 d_number = (int) ((nbcol * nbcol)/400); 00117 } else { 00118 d_number = m_desirednum; 00119 } 00120 if (d_number > 5000) d_number = 5000; 00121 } 00122 00123 int w_size; /* local window size */ 00124 int half_w_size; /* local window half size */ 00125 00126 /* Initialisation of some variable use when useScale == true */ 00127 if(useScale) 00128 { 00129 w_size = m_derivationSize; 00130 half_w_size = (int)(0.5*(w_size - 1)); 00131 } else { 00132 w_size = 5; 00133 half_w_size = 2; 00134 } 00135 00136 /* Computation of reduced first address */ 00137 int redu = ( (m_convolutionSize - 1) / 2 + (m_derivationSize -1) ); 00138 00139 /********************************************************************/ 00140 /* Corner Detection Routin */ 00141 /********************************************************************/ 00142 00143 for (int i = redu; i < nblig - redu; i++) { 00144 00145 HData* p_data_center = m_data + (i * nbcol) + redu; 00146 00147 HData* pix_win = p_data_center - half_w_size*nbcol - half_w_size; 00148 00149 HData* p_data_top1 = p_data_center - nbcol; 00150 HData* p_data_top1_right1 = p_data_top1+1; 00151 HData* p_data_top1_left1 = p_data_top1-1; 00152 00153 HData* p_data_down1 = p_data_center + nbcol; 00154 HData* p_data_down1_right1 = p_data_down1+1; 00155 HData* p_data_down1_left1 = p_data_down1-1; 00156 00157 HData* p_data_right1 = p_data_center + 1; 00158 HData* p_data_left1 = p_data_center - 1; 00159 00160 00161 for (int j = redu; j < nbcol - redu; j++) { 00162 if ( (std::min(p_data_center->im_low_curv,p_data_center->im_high_curv) > m_threshold) ) 00163 { 00164 bool OK_flag = true; 00165 for (int ii = 0; ii < w_size && OK_flag; ii++) { 00166 HData* pix_tmp = pix_win + ii * nbcol; 00167 for (int jj = 0; jj < w_size; jj++) { 00168 if (std::min(pix_tmp->im_low_curv,pix_tmp->im_high_curv) > 00169 std::min(p_data_center->im_low_curv,p_data_center->im_high_curv)) { OK_flag = false; break; }; 00170 pix_tmp++; 00171 } 00172 } 00173 if( OK_flag && ( !autoThreshold || lcorners.size() < d_number || ((HarrisDescriptor*)lcorners.back()->descriptor())->low() < std::min(p_data_center->im_high_curv,p_data_center->im_low_curv) ) ) 00174 { 00175 float b = 0.125*((p_data_top1_right1->im_high_curv) - (p_data_top1_left1->im_high_curv) + 00176 2.0*(p_data_right1->im_high_curv) - 2.0*(p_data_left1->im_high_curv) + 00177 (p_data_down1_right1->im_high_curv) - (p_data_down1_left1->im_high_curv) ); 00178 /* [-1 0 1] 00179 [-2 0 2] 00180 [-1 0 1] */ 00181 00182 float c = 0.125*((p_data_down1_left1->im_high_curv) - (p_data_top1_left1->im_high_curv) + 00183 2.0*(p_data_down1->im_high_curv) - 2.0*(p_data_top1->im_high_curv) + 00184 (p_data_down1_right1->im_high_curv) - (p_data_top1_right1->im_high_curv)); 00185 /* [-1 -2 -1] 00186 [ 0 0 0] 00187 [ 1 2 1] */ 00188 00189 float d = 0.25*((p_data_top1_left1->im_high_curv) + 2.0*(p_data_left1->im_high_curv) + (p_data_down1_left1->im_high_curv) - 00190 2.0*(p_data_top1->im_high_curv) - 4.0*(p_data_center->im_high_curv) - 2.0*(p_data_down1->im_high_curv) + 00191 (p_data_top1_right1->im_high_curv) + 2.0*(p_data_right1->im_high_curv) + (p_data_down1_right1->im_high_curv)); 00192 /* [1 -2 1] 00193 [2 -4 2] 00194 [1 -2 1] */ 00195 00196 float e = 0.25*(p_data_top1_left1->im_high_curv - p_data_down1_left1->im_high_curv - 00197 p_data_top1_right1->im_high_curv + p_data_down1_right1->im_high_curv); 00198 /* [ 1 0 -1] 00199 [ 0 0 0] 00200 [-1 0 1] */ 00201 00202 float f = 0.25*((p_data_top1_left1->im_high_curv) - 2.0*(p_data_left1->im_high_curv) + (p_data_down1_left1->im_high_curv)+ 00203 2.0*(p_data_top1->im_high_curv) - 4.0*(p_data_center->im_high_curv) + 2.0*(p_data_down1->im_high_curv)+ 00204 (p_data_top1_right1->im_high_curv) - 2.0*(p_data_right1->im_high_curv) + (p_data_down1_right1->im_high_curv)); 00205 /* [ 1 2 1] 00206 [-2 -4 -2] 00207 [ 1 2 1] */ 00208 00209 /* Quadratic fit function is 00210 F(x,y)=a + b x + c y + d/2 x^2 + e xy + f/2 y^2 00211 so, we find subpixel value setting the partial dervative 00212 of F to Zero ; 00213 [d e][offset_y]+[b]=[0]; 00214 [e f][offset_x] [c] [0] */ 00215 00216 float det = d*f - e*e; 00217 00218 if (det != 0) { 00219 float off_x = (b*e - c*d)/det; 00220 float off_y = (c*e - b*f)/det; 00221 if ((fabs(off_x) < 1.0)&&(fabs(off_y) < 1.0)) 00222 { 00223 InterestFeature* ip = useScale ? new InterestFeature(j+off_y, i+off_x) : new InterestFeature(j+off_y/2, i+off_x/2); 00224 double lHigh, lLow; 00225 if( p_data_center->im_high_curv > p_data_center->im_low_curv) 00226 { 00227 lHigh = p_data_center->im_high_curv ; 00228 lLow = p_data_center->im_low_curv; 00229 } else { 00230 lHigh = p_data_center->im_low_curv; 00231 lLow = p_data_center->im_high_curv ; 00232 } 00233 ip->setDescriptor( new HarrisDescriptor( ip, lHigh, lLow, image ) ); 00234 ip->setQuality(lLow); 00235 if(autoThreshold) 00236 { 00237 if(lcorners.empty()) 00238 { 00239 lcorners.push_back( ip ); 00240 } else { 00241 if(lcorners.size() >= d_number && lLow > ((HarrisDescriptor*)lcorners.back()->descriptor())->low()) 00242 { // remove last element, the totalNumber stay equal to d_number 00243 delete lcorners.back(); 00244 lcorners.pop_back(); 00245 } 00246 if(lcorners.size() < d_number ) 00247 { 00248 std::list<InterestFeature*>::iterator it; 00249 if(lLow < ((HarrisDescriptor*)lcorners.back()->descriptor())->low()) 00250 { 00251 lcorners.push_back(ip ); 00252 } else { 00253 // insert the new corner at his right place 00254 for(it = lcorners.begin(); it != lcorners.end(); it++) 00255 { 00256 if( lLow >= ((HarrisDescriptor*)((*it)->descriptor()))->low()) 00257 { 00258 lcorners.insert(it, ip); 00259 break; 00260 } 00261 } 00262 } 00263 } else { 00264 delete ip; 00265 } 00266 } 00267 } else { 00268 vcorners.addFeature(ip); 00269 } 00270 } 00271 } 00272 } 00273 } 00274 p_data_center++; 00275 pix_win++; 00276 p_data_top1++; 00277 p_data_top1_right1++; 00278 p_data_top1_left1++; 00279 00280 p_data_down1++; 00281 p_data_down1_right1++; 00282 p_data_down1_left1++; 00283 00284 p_data_right1++; 00285 p_data_left1++; 00286 } 00287 00288 } 00289 if(autoThreshold) { 00290 for(std::list<InterestFeature*>::iterator it = lcorners.begin(); it != lcorners.end(); ++it) 00291 { 00292 InterestFeature* ip = *it; 00293 vcorners.addFeature(ip); 00294 } 00295 } 00296 return vcorners; 00297 } 00298 } 00299 00300 // namespace fdetect_v2 { 00301 00302 // /** 00303 // * This class is the implements a detector of Harris points as described in : "A Combined 00304 // * Corner and Edge Detector" par C. Harris et M. Stephens en 1988. 00305 // * \ingroup fdetect 00306 // */ 00307 // class HarrisDetector : public fdetect_v2::Detector<fdetect_v2::HarrisDescriptor> 00308 // { 00309 // public: 00310 // enum Cornerness {HS_HARRIS, HS_EIGEN} ; 00311 // public: 00312 // /** 00313 // * @param scale_factor the scale used to search the interest point, it usually set to 1.0, 00314 // * but it might prove usefull to have it set to a different value if you know that 00315 // * there is a scale difference between the two images you are trying to match. 00316 // * @param derivationSigma the sigma used by the derivation kernel 00317 // * @param convolutionSigma the sigma used by the convolution kernel 00318 // * @param cornerness the type of cornerness (either using eigen values or the "harris" cornerness) 00319 // * @param threshold use to select point that are correctly different from their neighbourhood 00320 // * @param fixnumber set it to true if you want a given number of point which have the maximum 00321 // * cornerness (note that the threshold is still used to avoid selecting points which won't 00322 // * be good enought) 00323 // * @param desirednum the number of points (if set to -1 and fixnumber is true, an automatic number 00324 // * of points is used) 00325 // */ 00326 // HarrisDetector(float scale_factor = 1.0, float derivationSigma = 1.0, float convolutionSigma = 2.0, jafar::fdetect_v2::HarrisDetector::Cornerness cornerness = HS_EIGEN, float threshold = 0.0, bool fixnumber = true, int desirednum = 1000); 00327 // public: 00328 // virtual fdetect_v2::DetectionResult<fdetect_v2::HarrisDescriptor> detectIn(image::Image const& image); 00329 // virtual bool detectBestPntInRoi(jafar::image::Image const& image, 00330 // InterestFeature<fdetect_v2::HarrisDescriptor> * featPtr, 00331 // const jafar::image::ROI * roiPtr = 0 ); 00332 // public: 00333 // // inline double scaleFactor() { return m_scale_factor; } 00334 // float scaleFactor() const; 00335 // float derivationSigma() const; 00336 // float convolutionSigma() const; 00337 // float threshold() const; 00338 // Cornerness cornerness() const; 00339 // int desiredNumber() const; 00340 // int derivationSize() const; 00341 // int convolutionSize() const; 00342 // bool isFixNumber() const; 00343 00344 // private: 00345 // void gaussianDerivativesSA(jafar::image::Image const& image); 00346 // void gaussianDerivatives(jafar::image::Image const& image); 00347 // void gaussianDerivatives(jafar::image::Image const& image, const jafar::image::ROI & roi); 00348 // void gaussianConvolutionSA(jafar::image::Image const& image); 00349 // void gaussianConvolution(jafar::image::Image const& image); 00350 // void gaussianConvolution(jafar::image::Image const& image, const jafar::image::ROI & roi); 00351 // void computeHarrisCurvature (jafar::image::Image const& image); 00352 // void computeEigenCurvature (jafar::image::Image const& image); 00353 // void computeEigenCurvatureWithMax (jafar::image::Image const& image, int pixMax[2], float * scoreMax); 00354 // void cornerCharacteristics(DetectionResult<HarrisDescriptor>& points, jafar::image::Image const& image); 00355 // // void cornerCharacteristicsSA(vInterestFeatures& points, jafar::image::Image const& image); 00356 // template<bool autoThreshold, bool useScale> 00357 // DetectionResult<fdetect_v2::HarrisDescriptor> extractCorners (jafar::image::Image const& image); 00358 // private: 00359 // float m_scale_factor, m_derivationSigma, m_convolutionSigma, m_threshold; 00360 // Cornerness m_cornerness; 00361 // int m_desirednum, m_derivationSize, m_convolutionSize; 00362 // bool m_fixnumber; 00363 // struct HData { 00364 // float im_x, im_y, im_xx, im_xy, im_yy, im_conv_xx, im_conv_xy, im_conv_yy, im_high_curv, im_low_curv; 00365 // }; 00366 // HData* m_data; 00367 // }; 00368 00369 // template<bool autoThreshold, bool useScale> 00370 // DetectionResult<fdetect_v2::HarrisDescriptor> HarrisDetector::extractCorners (jafar::image::Image const& image) 00371 // { 00372 // using namespace jafar::fdetect_v2; 00373 // struct Corner 00374 // { 00375 // Corner(float* ihc, float pc) : im_high_corner(ihc), pix_center(pc) { } 00376 // float* im_high_corner; 00377 // float pix_center; 00378 // }; 00379 00380 // int nblig = image.height(); 00381 // int nbcol = image.width(); 00382 00383 // // Variables used when autoThreshold = true 00384 // unsigned int d_number; // nimber of points 00385 // std::list< InterestFeature<HarrisDescriptor>* > lcorners; // corners list 00386 // DetectionResult<HarrisDescriptor> vcorners; 00387 00388 // /* Cornerness Type */ 00389 // // switch (params->cornernessType) { 00390 // // case HS_HARRIS: 00391 // // pix_center_org = data->im_high_curv; 00392 // // pix_center_org1 = data->im_low_curv; 00393 // // break; 00394 // // case HS_EIGEN: 00395 // // pix_center_org = data->im_low_curv; 00396 // // pix_center_org1 = data->im_high_curv; 00397 // // break; 00398 // // default: 00399 // // JFR_PRECOND(false,"ERR_HS_BAD_PARAM"); 00400 // // } 00401 00402 // if(autoThreshold) 00403 // { 00404 // if( m_desirednum == -1) 00405 // { 00406 // d_number = (int) ((nbcol * nbcol)/400); 00407 // } 00408 // else 00409 // { 00410 // d_number = m_desirednum; 00411 // } 00412 // if (d_number > 5000) 00413 // d_number = 5000; 00414 // } 00415 00416 // int w_size; /* local window size */ 00417 // int half_w_size; /* local window half size */ 00418 00419 // /* Initialisation of some variable use when useScale == true */ 00420 // if(useScale) 00421 // { 00422 // w_size = m_derivationSize; 00423 // half_w_size = (int)(0.5*(w_size - 1)); 00424 // } 00425 // else 00426 // { 00427 // w_size = 5; 00428 // half_w_size = 2; 00429 // } 00430 00431 // /* Computation of reduced first address */ 00432 // int redu = ( (m_convolutionSize - 1) / 2 + (m_derivationSize -1) ); 00433 00434 // /********************************************************************/ 00435 // /* Corner Detection Routin */ 00436 // /********************************************************************/ 00437 00438 // for (int i = redu; i < nblig - redu; i++) 00439 // { 00440 // HData* p_data_center = m_data + (i * nbcol) + redu; 00441 00442 // HData* pix_win = p_data_center - half_w_size*nbcol - half_w_size; 00443 00444 // HData* p_data_top1 = p_data_center - nbcol; 00445 // HData* p_data_top1_right1 = p_data_top1+1; 00446 // HData* p_data_top1_left1 = p_data_top1-1; 00447 00448 // HData* p_data_down1 = p_data_center + nbcol; 00449 // HData* p_data_down1_right1 = p_data_down1+1; 00450 // HData* p_data_down1_left1 = p_data_down1-1; 00451 00452 // HData* p_data_right1 = p_data_center + 1; 00453 // HData* p_data_left1 = p_data_center - 1; 00454 00455 00456 // for (int j = redu; j < nbcol - redu; j++) 00457 // { 00458 // if ( (std::min(p_data_center->im_low_curv,p_data_center->im_high_curv) > m_threshold) ) 00459 // { 00460 // bool OK_flag = true; 00461 // for (int ii = 0; ii < w_size && OK_flag; ii++) 00462 // { 00463 // HData* pix_tmp = pix_win + ii * nbcol; 00464 // for (int jj = 0; jj < w_size; jj++) 00465 // { 00466 // if (std::min(pix_tmp->im_low_curv,pix_tmp->im_high_curv) > 00467 // std::min(p_data_center->im_low_curv,p_data_center->im_high_curv)) 00468 // { 00469 // OK_flag = false; 00470 // break; 00471 // }; 00472 // pix_tmp++; 00473 // } 00474 // } 00475 // if( OK_flag && ( !autoThreshold || 00476 // lcorners.size() < d_number || 00477 // (lcorners.back()->descriptor()).low() < std::min(p_data_center->im_high_curv,p_data_center->im_low_curv) ) ) 00478 // { 00479 // float b = 0.125*((p_data_top1_right1->im_high_curv) - (p_data_top1_left1->im_high_curv) + 00480 // 2.0*(p_data_right1->im_high_curv) - 2.0*(p_data_left1->im_high_curv) + 00481 // (p_data_down1_right1->im_high_curv) - (p_data_down1_left1->im_high_curv) ); 00482 // /* [-1 0 1] 00483 // [-2 0 2] 00484 // [-1 0 1] */ 00485 00486 // float c = 0.125*((p_data_down1_left1->im_high_curv) - (p_data_top1_left1->im_high_curv) + 00487 // 2.0*(p_data_down1->im_high_curv) - 2.0*(p_data_top1->im_high_curv) + 00488 // (p_data_down1_right1->im_high_curv) - (p_data_top1_right1->im_high_curv)); 00489 // /* [-1 -2 -1] 00490 // [ 0 0 0] 00491 // [ 1 2 1] */ 00492 00493 // float d = 0.25*((p_data_top1_left1->im_high_curv) + 2.0*(p_data_left1->im_high_curv) + (p_data_down1_left1->im_high_curv) - 00494 // 2.0*(p_data_top1->im_high_curv) - 4.0*(p_data_center->im_high_curv) - 2.0*(p_data_down1->im_high_curv) + 00495 // (p_data_top1_right1->im_high_curv) + 2.0*(p_data_right1->im_high_curv) + (p_data_down1_right1->im_high_curv)); 00496 // /* [1 -2 1] 00497 // [2 -4 2] 00498 // [1 -2 1] */ 00499 00500 // float e = 0.25*(p_data_top1_left1->im_high_curv - p_data_down1_left1->im_high_curv - 00501 // p_data_top1_right1->im_high_curv + p_data_down1_right1->im_high_curv); 00502 // /* [ 1 0 -1] 00503 // [ 0 0 0] 00504 // [-1 0 1] */ 00505 00506 // float f = 0.25*((p_data_top1_left1->im_high_curv) - 2.0*(p_data_left1->im_high_curv) + (p_data_down1_left1->im_high_curv)+ 00507 // 2.0*(p_data_top1->im_high_curv) - 4.0*(p_data_center->im_high_curv) + 2.0*(p_data_down1->im_high_curv)+ 00508 // (p_data_top1_right1->im_high_curv) - 2.0*(p_data_right1->im_high_curv) + (p_data_down1_right1->im_high_curv)); 00509 // /* [ 1 2 1] 00510 // [-2 -4 -2] 00511 // [ 1 2 1] */ 00512 00513 // /* Quadratic fit function is 00514 // F(x,y)=a + b x + c y + d/2 x^2 + e xy + f/2 y^2 00515 // so, we find subpixel value setting the partial dervative 00516 // of F to Zero ; 00517 // [d e][offset_y]+[b]=[0]; 00518 // [e f][offset_x] [c] [0] */ 00519 00520 // float det = d*f - e*e; 00521 00522 // if (det != 0) 00523 // { 00524 // float off_x = (b*e - c*d)/det; 00525 // float off_y = (c*e - b*f)/det; 00526 // if ((fabs(off_x) < 1.0)&&(fabs(off_y) < 1.0)) 00527 // { 00528 // InterestFeature<HarrisDescriptor>* ip = useScale ? new InterestFeature<HarrisDescriptor>(j+off_y, i+off_x) : new InterestFeature<HarrisDescriptor>(j+off_y/2, i+off_x/2); 00529 // double lHigh, lLow; 00530 // if( p_data_center->im_high_curv > p_data_center->im_low_curv) 00531 // { 00532 // lHigh = p_data_center->im_high_curv ; 00533 // lLow = p_data_center->im_low_curv; 00534 // } 00535 // else 00536 // { 00537 // lHigh = p_data_center->im_low_curv; 00538 // lLow = p_data_center->im_high_curv ; 00539 // } 00540 // HarrisDescriptor hd( lHigh, lLow, ip->u(), ip->v(), image ); 00541 // ip->setDescriptor( hd ); 00542 // ip->setQuality(lLow); 00543 // if(autoThreshold) 00544 // { 00545 // if(lcorners.empty()) 00546 // { 00547 // lcorners.push_back( ip ); 00548 // } 00549 // else 00550 // { 00551 // if(lcorners.size() >= d_number && lLow > (lcorners.back()->descriptor()).low()) 00552 // { // remove last element, the totalNumber stay equal to d_number 00553 // delete lcorners.back(); 00554 // lcorners.pop_back(); 00555 // } 00556 // if(lcorners.size() < d_number ) 00557 // { 00558 // std::list< InterestFeature<HarrisDescriptor>* >::iterator it; 00559 // if(lLow < (lcorners.back()->descriptor()).low()) 00560 // { 00561 // lcorners.push_back(ip ); 00562 // } 00563 // else 00564 // { 00565 // // insert the new corner at his right place 00566 // for(it = lcorners.begin(); it != lcorners.end(); it++) 00567 // { 00568 // if( lLow >= ((*it)->descriptor()).low() ) 00569 // { 00570 // lcorners.insert(it, ip); 00571 // break; 00572 // } 00573 // } 00574 // } 00575 // } 00576 // else 00577 // { 00578 // delete ip; 00579 // } 00580 // } 00581 // } 00582 // else 00583 // { 00584 // vcorners.push_back(ip); 00585 // } 00586 // } 00587 // } 00588 // } 00589 // } 00590 // p_data_center++; 00591 // pix_win++; 00592 // p_data_top1++; 00593 // p_data_top1_right1++; 00594 // p_data_top1_left1++; 00595 00596 // p_data_down1++; 00597 // p_data_down1_right1++; 00598 // p_data_down1_left1++; 00599 00600 // p_data_right1++; 00601 // p_data_left1++; 00602 // } 00603 00604 // } 00605 // if(autoThreshold) 00606 // { 00607 // for(std::list< InterestFeature<HarrisDescriptor>* >::const_iterator it = lcorners.begin(); 00608 // it != lcorners.end(); 00609 // ++it) 00610 // { 00611 // vcorners.push_back(*it); 00612 // } 00613 // } 00614 // return vcorners; 00615 // } 00616 // } 00617 } 00618 00619 #endif
Generated on Wed Oct 15 2014 00:37:18 for Jafar by doxygen 1.7.6.1 |