Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

What is the distance used by K-nearest neighbour in opencv

Hello,

I am using the machine learning k-nearest neighbour algrithm c++. I have a dataset with a high dimensional features. So, the euclidian distance will be not the best. I try to find which distance used in knearest.cpp to change it and used different distances but I could not because the code lacks comments. I find this block in the 189 but It seems that it not used in the find_nearest function. Any help?

> for( ; t < d; t++ )
>                 {
>                 
>                    double t0 = u[t] - v[t];
>                     sum += t0*t0;
>                     
>                 }