Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenCV euclidean distance between two vectors

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?

like image 265
farahm Avatar asked Apr 16 '14 09:04

farahm


People also ask

How do you find the Euclidean distance between two vectors in Python?

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.

How do you find the distance between two points in Opencv Python?

Distance using √[(x₂ - x₁)² + (y₂ - y₁)²].


1 Answers

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);
like image 176
berak Avatar answered Oct 23 '22 16:10

berak