/** * Adjusts the descriptor. This adds lighting invariance and reduces the affects of none-affine changes * in lighting. * * 1) Apply L2 normalization * 2) Clip using max descriptor value * 3) Apply L2 normalization again */ public static void normalizeDescriptor(TupleDesc_F64 descriptor , double maxDescriptorElementValue ) { // normalize descriptor to unit length UtilFeature.normalizeL2(descriptor); // clip the values for (int i = 0; i < descriptor.size(); i++) { double value = descriptor.value[i]; if( value > maxDescriptorElementValue ) { descriptor.value[i] = maxDescriptorElementValue; } } // normalize again UtilFeature.normalizeL2(descriptor); }
/** * <p> * Computes the SURF descriptor for the specified interest point. If the feature * goes outside of the image border (including convolution kernels) then null is returned. * </p> * * @param x Location of interest point. * @param y Location of interest point. * @param angle The angle the feature is pointing at in radians. * @param scale Scale of the interest point. Null is returned if the feature goes outside the image border. * @param ret storage for the feature. Must have 64 values. */ public void describe(double x, double y, double angle, double scale, BrightFeature ret) { describe(x, y, angle, scale, (TupleDesc_F64) ret); // normalize feature vector to have an Euclidean length of 1 // adds light invariance UtilFeature.normalizeL2(ret); // Laplacian's sign ret.white = computeLaplaceSign((int)(x+0.5),(int)(y+0.5), scale); }
public void describe(double x, double y, double angle, double scale, BrightFeature desc) { int featureIndex = 0; for( int band = 0; band < ii.getNumBands(); band++ ) { describe.setImage(ii.getBand(band)); describe.describe(x,y, angle, scale, bandDesc); System.arraycopy(bandDesc.value,0,desc.value,featureIndex,bandDesc.size()); featureIndex += bandDesc.size(); } UtilFeature.normalizeL2(desc); describe.setImage(grayII); desc.white = describe.computeLaplaceSign((int)(x+0.5),(int)(y+0.5),scale); }