double computeAngle ( int index1 ) { int index0 = CircularIndex . addOffset ( index1 , - 1 , histogramMag . length ) ; int index2 = CircularIndex . addOffset ( index1 , 1 , histogramMag . length ) ; // compute the peak location using a second order polygon double v0 = histogramMag [ index0 ] ; double v1 = histogramMag [ index1 ] ; double v2 = histogramMag [ index2 ] ; double offset = FastHessianFeatureDetector . polyPeak ( v0 , v1 , v2 ) ; // interpolate using the index offset and angle of its neighbor return interpolateAngle ( index0 , index1 , index2 , offset ) ; }
Compute the angle . The angle for each neighbor bin is found using the weighted sum of the derivative . Then the peak index is found by 2nd order polygon interpolation . These two bits of information are combined and used to return the final angle output .