public void computeNccDescriptor ( NccFeature f , float x0 , float y0 , float x1 , float y1 ) { double mean = 0 ; float widthStep = ( x1 - x0 ) / 15.0f ; float heightStep = ( y1 - y0 ) / 15.0f ; // compute the mean value int index = 0 ; for ( int y = 0 ; y < 15 ; y ++ ) { float sampleY = y0 + y * heightStep ; for ( int x = 0 ; x < 15 ; x ++ ) { mean += f . value [ index ++ ] = interpolate . get_fast ( x0 + x * widthStep , sampleY ) ; } } mean /= 15 * 15 ; // compute the variance and save the difference from the mean double variance = 0 ; index = 0 ; for ( int y = 0 ; y < 15 ; y ++ ) { for ( int x = 0 ; x < 15 ; x ++ ) { double v = f . value [ index ++ ] -= mean ; variance += v * v ; } } variance /= 15 * 15 ; f . mean = mean ; f . sigma = Math . sqrt ( variance ) ; }
Computes the NCC descriptor by sample points at evenly spaced distances inside the rectangle