# EMD vs EMDL1: who is right?

Hello all,

EMD and EMDL1 seem to provide different values for the same signatures. Can anybody explain? You can find my code below.

Thanks!

int main(int argc, char** argv)
{

//make signature
Mat sig1(4, 3, CV_32FC1);
Mat sig2(4, 3, CV_32FC1);

sig1.at< float>(0, 0) = 0.5;
sig1.at< float>(0, 1) = 0;
sig1.at< float>(0, 2) = 0;

sig1.at< float>(1, 0) = 0.5;
sig1.at< float>(1, 1) = 1;
sig1.at< float>(1, 2) = 1;

sig1.at< float>(2, 0) = 0.0;
sig1.at< float>(2, 1) = 1;
sig1.at< float>(2, 2) = 0;

sig1.at< float>(3, 0) = 0.0;
sig1.at< float>(3, 1) = 0;
sig1.at< float>(3, 2) = 1;

sig2.at< float>(0, 0) = .25;
sig2.at< float>(0, 1) = 0;
sig2.at< float>(0, 2) = 0;

sig2.at< float>(1, 0) = .25;
sig2.at< float>(1, 1) = 1;
sig2.at< float>(1, 2) = 1;

sig2.at< float>(2, 0) = .25;
sig2.at< float>(2, 1) = 1;
sig2.at< float>(2, 2) = 0;

sig2.at< float>(3, 0) = .25;
sig2.at< float>(3, 1) = 0;
sig2.at< float>(3, 2) = 1;

float emd = cv::EMD(sig1, sig2, CV_DIST_L1); //emd 0 is best matching.
printf("similarity emd %5.5f %%\n", (1 - emd) * 100);

emd = cv::EMDL1(sig1, sig2); //emd 0 is best matching.
printf("similarity emd L1 %5.5f %%\n", (1 - emd) * 100);

waitKey(0); // Wait for a keystroke in the window
return 0;
}

edit retag close merge delete

Sort by ยป oldest newest most voted

Hi,

These two functions do not compute the same thing : cv::EMD(<params>) takes the point's coordinates into account whereas EMDL1(<params>) only uses the weights. Please refer to the documentation: EMDL1, EMD.

Please also read the documentation before posting, as this is a duplicate of this question on the same forum.

Hope this helps.

more

Official site

GitHub

Wiki

Documentation

## Stats

Asked: 2015-09-17 03:50:11 -0500

Seen: 175 times

Last updated: Apr 27 '18