void CompareFREAK84(LongDescripter768 desc, double[] samples) { int pos = 0;//84bitだと・・・ //[63..0] long tmp = 0; int idx = 0; for (int i = 0; i < 37; i++) { for (int j = i + 1; j < 37; j++) { if (samples[i] < samples[j]) { tmp |= (1L << (pos)); } pos++; if (pos == 64) { pos = 0; desc._desc[idx] = tmp; tmp = 0; idx++; } } } desc._desc[idx] = tmp; return; }
/** * Extract a descriptor from the pyramid for a single point. */ bool ExtractFREAK84( LongDescripter768 i_desc, // unsigned char desc[84], GaussianScaleSpacePyramid pyramid, DogFeaturePoint point, double[] points_ring0, double[] points_ring1, double[] points_ring2, double[] points_ring3, double[] points_ring4, double[] points_ring5, double sigma_center, double sigma_ring0, double sigma_ring1, double sigma_ring2, double sigma_ring3, double sigma_ring4, double sigma_ring5, double expansion_factor) { double[] samples = new double[37]; // Create samples if (!SamplePyramidFREAK84(samples, pyramid, point, points_ring0, points_ring1, points_ring2, points_ring3, points_ring4, points_ring5, sigma_center, sigma_ring0, sigma_ring1, sigma_ring2, sigma_ring3, sigma_ring4, sigma_ring5, expansion_factor)) { return(false); } // Once samples are created compute descriptor CompareFREAK84(i_desc, samples); return(true); }