Is the opencv cosDistance.compute cosine similarity as per the formula , below is the c++ code snippet which seem to yield two different result for cosine similarity ?
I afraid the computed cosine is still almost 1.9999 times higher the lower cosdist computed by opencv ie computed =1.9999xopencv 's CosDistance , any reason why the opencv computation is much lower than the cosine formulation ?
source code
double xy = descr1.dot(descr2);
double xx = descr1.dot(descr1);
double yy = descr2.dot(descr2);
double norm = sqrt(xx * yy) + 1e-6;
return 0.5f * static_cast(1.0 - xy / norm);
I just wonder what is the reason behind application of 0.5 factor reduction , the document never mentioned this is a modified version of the original cosine similarity which measures the cosine of the angle between two vectors projected in a multi-dimensional space.