 
     #pragma unroll
     for( int i=0; i<ORIENTATION_MAX_COUNT; i++ ) {
-        maxbin[i] = 0;
+        maxbin[i] = -1;
         y_max[i] = -INFINITY;
     }
 

        if( idx >= d_max_orientations ) break;

        float chosen_bin = xcoord[maxbin[i]];
        chosen_bin -= ( chosen_bin >= ORI_NBINS ? float(ORI_NBINS) : 0.0f );
        float th = __fdividef(M_PI2 * chosen_bin, ORI_NBINS) - M_PI;

        ext = &extremum[idx];

#include <inttypes.h>

using namespace popart;
using namespace std;

// Lowe wants at most 3 orientations at every extremum,
// VLFeat uses at most 4, OpenCV all it can find
