src/search_engine/relja_retrival/external/KMCode_relja/descriptor/SiftDescriptor.cpp
/* Given a sample from the image gradient, place it in the index array.
*/
Given a sample from the image gradient, place it in the index array.
Given a sample from the image gradient place it in the index array .
void SiftDescriptor::AddSample(float *index,
	       DARY *grad, DARY *orim, int r, int c, float rpos, float cpos,
	       float rx, float cx)
{
    float mag, ori, sigma, weight;
    if (r < 0  ||  r >= grad->y()  ||  c < 0  ||  c >= grad->x())
       return;
    mag = patch_mask->fel[r][c] * grad->fel[r][c];
    ori = orim->fel[r][c];
    while (ori > M_2PI)
      ori -= M_2PI;
    while (ori < 0.0)
      ori += M_2PI;     
    PlaceInIndex(index, mag, ori, rx, cx);
}
void SiftDescriptor :: AddSample ( float * index , DARY * grad , DARY * orim , int r , int c , float rpos , float cpos , float rx , float cx ) { float mag , ori , sigma , weight ; if ( r < 0 || r >= grad -> y ( ) || c < 0 || c >= grad -> x ( ) ) return ; mag = patch_mask -> fel [ r ] [ c ] * grad -> fel [ r ] [ c ] ; ori = orim -> fel [ r ] [ c ] ; while ( ori > M_2PI ) ori -= M_2PI ; while ( ori < 0.0 ) ori += M_2PI ; PlaceInIndex ( index , mag , ori , rx , cx ) ; }
Given a sample from the image gradient, place it in the index array.
Given a sample from the image gradient place it in the index array .
/* Clip at image boundaries. */ /* Compute Gaussian weight for sample, as function of radial distance
       from center.  Sigma is relative to half-width of index. */ //sigma =  0.5*(IndexSize+1)*(IndexSize+1); //sigma = (IndexSize+1)*(IndexSize+1); //weight = 0.6*exp(- (rpos * rpos + cpos * cpos) / (sigma) ); //cout << "rpos "<< rpos << " cpos "<< cpos << " weight " << weight<< endl; //mag = weight * grad->fel[r][c]; /* Subtract keypoint orientation to give ori relative to keypoint. */ /* Put orientation in range [0, 2*PI].  If sign of gradient is to
       be ignored, then put in range [0, PI]. */