src/search_engine/relja_retrival/external/KMCode_relja/descriptor/FastDetector.cpp
/****** HARRIS FAST derivation sigma = 1, integration sigma =1.4***********/
HARRIS FAST derivation sigma = 1, integration sigma =1.4
HARRIS FAST derivation sigma = 1 integration sigma = 1 . 4
void harris_fast(DARY *image_in, DARY *corner_image){
   int col_nb, row_nb;
   float A, B, C, determinant, trace, t1,t2;
   row_nb = image_in->y();
   col_nb = image_in->x();
   DARY  *fx= new DARY(row_nb,col_nb);	
   dX6(image_in, fx);
   DARY  *fy= new DARY(row_nb,col_nb);	
   dY6(image_in, fy);
   DARY *fxy  = new DARY(row_nb, col_nb);
   for (int row = 0; row < row_nb; row++)
       for (int col = 0; col < col_nb; col++){
	   t1 = fx->fel[row][col];
	   t2 = fy->fel[row][col];
	   fx->fel[row][col] = t1*t1;
	   fy->fel[row][col] = t2*t2;
	   fxy->fel[row][col] = t1*t2;
       }
   DARY *sfx2  = new DARY(row_nb, col_nb);   
   smoothSqrt(fx,sfx2);  delete fx;
   DARY *sfy2  = new DARY(row_nb, col_nb);
   smoothSqrt(fy,sfy2);  delete fy;
   DARY *sfxy  = new DARY(row_nb, col_nb);
   smoothSqrt(fxy,sfxy); delete fxy;
   for (int row = 0; row < row_nb; row++)
     for (int col = 0; col < col_nb; col++)
       {
        A = sfx2->fel[row][col];
        B = sfy2->fel[row][col];
        C = sfxy->fel[row][col];
        determinant = A * B - (C*C);
        trace = A + B;
        corner_image->fel[row][col] = (determinant - ALPHA * (trace*trace));
       }
   delete sfx2; delete sfy2;  delete sfxy;
}
void harris_fast ( DARY * image_in , DARY * corner_image ) { int col_nb , row_nb ; float A , B , C , determinant , trace , t1 , t2 ; row_nb = image_in -> y ( ) ; col_nb = image_in -> x ( ) ; DARY * fx = new DARY ( row_nb , col_nb ) ; dX6 ( image_in , fx ) ; DARY * fy = new DARY ( row_nb , col_nb ) ; dY6 ( image_in , fy ) ; DARY * fxy = new DARY ( row_nb , col_nb ) ; for ( int row = 0 ; row < row_nb ; row ++ ) for ( int col = 0 ; col < col_nb ; col ++ ) { t1 = fx -> fel [ row ] [ col ] ; t2 = fy -> fel [ row ] [ col ] ; fx -> fel [ row ] [ col ] = t1 * t1 ; fy -> fel [ row ] [ col ] = t2 * t2 ; fxy -> fel [ row ] [ col ] = t1 * t2 ; } DARY * sfx2 = new DARY ( row_nb , col_nb ) ; smoothSqrt ( fx , sfx2 ) ; delete fx ; DARY * sfy2 = new DARY ( row_nb , col_nb ) ; smoothSqrt ( fy , sfy2 ) ; delete fy ; DARY * sfxy = new DARY ( row_nb , col_nb ) ; smoothSqrt ( fxy , sfxy ) ; delete fxy ; for ( int row = 0 ; row < row_nb ; row ++ ) for ( int col = 0 ; col < col_nb ; col ++ ) { A = sfx2 -> fel [ row ] [ col ] ; B = sfy2 -> fel [ row ] [ col ] ; C = sfxy -> fel [ row ] [ col ] ; determinant = A * B - ( C * C ) ; trace = A + B ; corner_image -> fel [ row ] [ col ] = ( determinant - ALPHA * ( trace * trace ) ) ; } delete sfx2 ; delete sfy2 ; delete sfxy ; }
HARRIS FAST derivation sigma = 1, integration sigma =1.4
HARRIS FAST derivation sigma = 1 integration sigma = 1 . 4
//printf("- Starting to calculate gradients \n"); /*        A = B = C = determinant = trace = 0.0;*/