Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

K-Nearest Neighbors, SURF and classifying images.

Hello,

I've been tasked with the problem of creating a system capable of classifying two sets of images. These images are going to be either natural (landscapes) or man-made (buildings). Initially I'm supplied with a set of N images from one class and N from the other - the training set.

The way I imagine this system to work is to extract features with something like SURF and classify them using KNN. Thing is I don't quite get how to combine these two algorithms.

What I understand is that I can detect features with the detect function of the SurfFeatureDetector. I can also extract descriptors of these features with SurfDescriptorExtractor and compute. What I don't understand is how to send these features to KNN.

I presume that when one wants to use KNN in OpenCV the extracted feature descriptors are the trainData parameter of KNN, but what is the responses parameter, what do I pass there.

Also if my approach of using SURF is not optimal I would be very grateful if somebody suggests something different, just bare in mind I'm very new to the field of Computer Vision so anything terribly complex probably wouldn't suit me.

Thanks.