         }
     }
 
-    float chosen_bin = xcoord[maxbin[0]];
+    float chosen_bin = refined_angle[maxbin[0]];
     if( chosen_bin >= ORI_NBINS ) chosen_bin -= ORI_NBINS;
 
     float th = __fdividef(M_PI2 * chosen_bin , ORI_NBINS) - M_PI;

#include "sift_constants.h"
#include "s_gradiant.h"
#include "excl_blk_prefix_sum.h"
#include "debug_macros.h"

using namespace popart;


            float newbin = __fdividef( num, denB ); // * M_PI/18.0f; // * 10.0f;
            if( newbin >= 0 && newbin <= 2 ) {
                refined_angle[bin] = prev + newbin;
                yval[bin]   = -(num*num) / (4.0f * denB) + hist[prev];

#ifdef LOWE_ORIENTATION_MAX
