Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Has anyone implemented in Mathematica the Earth Mover's Distance (EMD)? A concept dating back to Monge 1871, used to compare histograms and images, e.g., the CIEDE2000 Color Difference algorithm. Yossi Rubner's C implementation can be found here:

Computation of EMD is more involved than Euclidean metric. EMD is a linear constrained optimization problem, and so can be handled presumably via Mathematica's Linear Programming functionality. Although there's typically additional normalization stage, e.g.. found here.

share|improve this question
Couldn't you just link to the compiled code you refer to? – Sjoerd C. de Vries Apr 4 '12 at 21:15
A related demonstration at Monge-Kantorovich Problem – kglr Apr 4 '12 at 21:58
@SCdeV, 2many papers 2read. There's the Wavelet dual EMD approximation, there's Quadratic Chi metrics, there's a whole book called Dictionary of Distances. And then there's the ultrametric paradise, in sparse data regimes where all triangles are isoceles w/ small base. – alancalvitti Apr 5 '12 at 18:14
If you mangle my name the @-calling mechanism won't notify me. I just happened to chance by now. My remark was not about reading stuff but about linking to the C code. – Sjoerd C. de Vries Apr 7 '12 at 6:28
I meant linking Mathematica (not this question) to the C code. There are several mechanisms to do this. – Sjoerd C. de Vries Apr 11 '12 at 5:47

In Mathematica 9, it is already implemented under ImageDistance.

See Similarity Graph of Images Using Earth Mover Distance.

share|improve this answer
Well this would be one easy bounty... – shrx Nov 30 '13 at 12:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.