src/search_engine/relja_retrival/external/KMCode_relja/descriptor/CornerDetector.cpp
/****COMPUTING LAPLACIAN AND REJECTING IF IT IS NOT A MAXIMUM******/
COMPUTING LAPLACIAN AND REJECTING IF IT IS NOT A MAXIMUM
COMPUTING LAPLACIAN AND REJECTING IF IT IS NOT A MAXIMUM
void computLaplacian(DARY* image, vector<CornerDescriptor*>&corners, float lap_threshold, float step){
    float sc,dxx1,dxx0,dxx2,sc0,sc2;
    for (unsigned int c =0  ; c < corners.size(); c++){
      cout << "\rcorner "<< c<<flush;
      sc=corners[c]->getCornerScale();
      int row = (int)corners[c]->getY();
      int col = (int)corners[c]->getX();
      sc0=sc/step;
      sc2=sc*step;
      dxx0=sc0*sc0*dXX_YYf(col,row,image,sc0);
      dxx1=sc*sc*dXX_YYf(col,row,image,sc);
      dxx2=sc2*sc2*dXX_YYf(col,row,image,sc2);
      corners[c]->setLap(dxx1);
      if(dxx1>dxx2&& dxx1>dxx0)corners[c]->setMax();
      else if(dxx1<dxx2&& dxx1<dxx0)corners[c]->setMin();
    }  
    for(uint i=0;i<corners.size();i++){
      if(!corners[i]->isExtr()){
        delete corners[i];
        corners.erase(corners.begin() + i);
	    i--;
      }
    }    
}
void computLaplacian ( DARY * image , vector < CornerDescriptor * > & corners , float lap_threshold , float step ) { float sc , dxx1 , dxx0 , dxx2 , sc0 , sc2 ; for ( unsigned int c = 0 ; c < corners . size ( ) ; c ++ ) { cout << " \r " << c << flush ; sc = corners [ c ] -> getCornerScale ( ) ; int row = ( int ) corners [ c ] -> getY ( ) ; int col = ( int ) corners [ c ] -> getX ( ) ; sc0 = sc / step ; sc2 = sc * step ; dxx0 = sc0 * sc0 * dXX_YYf ( col , row , image , sc0 ) ; dxx1 = sc * sc * dXX_YYf ( col , row , image , sc ) ; dxx2 = sc2 * sc2 * dXX_YYf ( col , row , image , sc2 ) ; corners [ c ] -> setLap ( dxx1 ) ; if ( dxx1 > dxx2 && dxx1 > dxx0 ) corners [ c ] -> setMax ( ) ; else if ( dxx1 < dxx2 && dxx1 < dxx0 ) corners [ c ] -> setMin ( ) ; } for ( uint i = 0 ; i < corners . size ( ) ; i ++ ) { if ( ! corners [ i ] -> isExtr ( ) ) { delete corners [ i ] ; corners . erase ( corners . begin ( ) + i ) ; i -- ; } } }
COMPUTING LAPLACIAN AND REJECTING IF IT IS NOT A MAXIMUM
COMPUTING LAPLACIAN AND REJECTING IF IT IS NOT A MAXIMUM
//compute the integration scale //is OK //is OK //corners.erase((std::vector<CornerDescriptor*>::iterator)&corners[i]);