I want to calculate the euclidean distance between two vectors (or two Matrx rows, doesn't matter). Is there a good function for that in OpenCV?
The math. dist() method returns the Euclidean distance between two points (p and q), where p and q are the coordinates of that point. Note: The two points (p and q) must be of the same dimensions.
Distance using √[(x₂ - x₁)² + (y₂ - y₁)²].
yes.
Mat a,b; // num of rows/cols/channels does not matter, they just have to be equal for both
double dist = norm(a,b,NORM_L2);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With