This code is the mex interface for computing Earth Movers Distance between signatures and is based on the Y. Rubner's C Implementation.
For building the mex file you should have setup your mex build environment. Invoke "build_emd" for building and "demo_emd" for a small test.
Ubuntu 17.10 64 bit with 2017a, with modifications by Patrick. Ignored the gcc message when running build_emd.m as-is, and everything is working fine for the simple example. I'll report further if this changes for full-scale use.
The code worked really well on Windows 10. I'm now keen to run the code on Ubuntu 16.0.4 (64 bit) with 2017a and modified the code as suggested by Patrick. Further , I had to install gcc v4.9 and modify the build_emd.m as follows:
mex -v GCC='usr/bin/gcc-4.9' emd_mex.c emd.c -O
The build was successful to yield emd_mex.mexa64. However, running the demo_emd has ended up in "core dump" with termination of Matlab. Does anybody advise me how to debug the mex file?
I have a 64 bit Linux system. To get this code to work, I needed to make the following modifications.
1. In emd_mex.c line 106: change "//maxsimum size of flow" to "/*maxsimum size of flow*/" since the "//" for single-line C comments are Microsoft only.
2. Add a line break to the end of emd_mex.c and save.
3. Run build_emd.
Thanks, and I hope that was helpful.
Michaels question is justified. The features (bin locations) are computed within the mex as consecutive indices. Thus, for a complete definition of a signature, you have to include the full span of weights for all bins (which is cumbersome if working with multidimensional signatures).
Works really well. Thank you for doing this.
Where are the actual features (signatures) defined? The demo only uses the weights and the ground distance matrix?
Great, works perfect!!!