cv::KNearest : change distance used

asked 2013-11-04 06:14:14 -0600

JNB gravatar image

I am currently using cv::KNearest to classify some images and it works fine, but I can't seem to find which distance is used to find out "how near" are the train samples. My guess would be Euclidean but I didn't find any clue to confirm that.

Moreover I'd like to try several distance measures to compare their efficiency, as I was told that chi-square performs best in my application. Is it possible to do so with this implementation of the KNN algorithm?

thanks by advance for your answers !

edit retag flag offensive close merge delete

Comments

had a look at the code ? does not seem, you can change it.

berak gravatar imageberak ( 2013-11-04 06:59:50 -0600 )edit

Right, I did not look at it, and it will be helpful to understand which measure is used for now. But does this mean that there is nothing already built in to change the distance used ? Changing OpenCV does not seem like a good option to me, since my code is a small part of a big framework which should be easy to install on other machines. Changing the libraries make it less portable and I would have to find another knn implementation or implement one myself.

JNB gravatar imageJNB ( 2013-11-04 09:39:35 -0600 )edit