Simple Example

// Define in header params
#define SURF_HESSIAN_THRESH 0.01f
using namespace cv;

/* GetSURFFeatures
 * This will clean up the cached values to avoid memory leaks
 *		IplImage*grayImg	-	Input grayscale image
 *		IplImage*mask		-	Mask to filter points
 */
void CFeatureSet::GetSURFFeatures(IplImage*grayImg,IplImage * mask){
	// Create output variables
	vector keyPoints;
	vector descriptor;

	// Create SURF Class
	SURF surf(SURF_HESSIAN_THRESH,4,2,false);

	// Generate Points and Descriptors
	surf(grayImg,mask,keyPoints,descriptor);

	// This is some code to put it into my data structure
	// see my FeatureSet.h Class for more details
	int length = surf.descriptorSize();
	float * desc = new float[length];
	for(int i = 0 ; i < (int)keyPoints.size() ; i++){
		KeyPoint t = keyPoints[i];
		// Parse the descriptor vector for the relevant descriptor
		for (int j = 0 ; j < length ; j++){
			desc[j] = descriptor[(i*length)+j];
		}
		// Create New Feature and pass in the details
		CFeat * feat = new CFeat(t.pt.x,t.pt.y,t.angle,t.octave,desc,length);
		// Store in feature vector
		_features.push_back(feat);
	}
	// Clean Up
	delete [] desc;
}
// Bugs caused by html displayer