Calc eucliadian distance between two single point ?
I have
Point2f a(10,10);
Point2f b(100,100);
I would like to calc the distance (Euclidean) between these two points. Instead to write the manual function:
float euclideanDist(Point& p, Point& q) {
Point diff = p - q;
return cv::sqrt(diff.x*diff.x + diff.y*diff.y);
}
Is there any OpenCV function? (That's pretty similary to what does descriptormatcher.match() with L2_NORM)
Just a comment about your euclideanDist function: if diff.x (or diff.y) is too big it can overflow and the function will give you an incorrect distance. You can avoid the problem using the C/C++ standard function called hypot or _hypot. For more info see http://www.johndcook.com/blog/2010/06/02/whats-so-hard-about-finding-a-hypotenuse/