OpenCV euclidean distance between two vectors

farahm picture farahm · Apr 16, 2014 · Viewed 17.9k times · Source

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?

Answer

berak picture berak · Apr 16, 2014

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);