ICSV - Image Color Similarity Visualization
Vienna Technical University - Course 'Visualization 2'. Author: Stefan Spelitz (0925601)
ICSV.Server.FastEMD.FastEMD Class Reference

See https://github.com/telmomenezes/JFastEMD/blob/master/src/com/telmomenezes/jfastemd/JFastEMD.java More...

Static Public Member Functions

static double distance (Signature signature1, Signature signature2, double extraMassPenalty)
 This interface is similar to Rubner's interface. See: http://www.cs.duke.edu/~tomasi/software/emd.htm More...
 

Detailed Description

See https://github.com/telmomenezes/JFastEMD/blob/master/src/com/telmomenezes/jfastemd/JFastEMD.java

This class computes the Earth Mover's Distance, using the EMD-HAT algorithm created by Ofir Pele and Michael Werman.

This implementation is strongly based on the C++ code by the same authors, that can be found here: http://www.cs.huji.ac.il/~ofirpele/FastEMD/code/

Some of the author's comments on the original were kept or edited for this context.

Author
Telmo Menezes (telmo.nosp@m.@tel.nosp@m.momen.nosp@m.ezes.nosp@m..com)

Member Function Documentation

static double ICSV.Server.FastEMD.FastEMD.distance ( Signature  signature1,
Signature  signature2,
double  extraMassPenalty 
)
static

This interface is similar to Rubner's interface. See: http://www.cs.duke.edu/~tomasi/software/emd.htm

This method computes the EMD between the given two signatures.

To get the same results as Rubner's code you should set extra_mass_penalty to 0, and divide by the minimum of the sum of the two signature's weights. However, I suggest not to do this as you lose the metric property and more importantly, in my experience the performance is better with emd_hat. for more on the difference between emd and emd_hat, see the paper: A Linear Time Histogram Metric for Improved SIFT Matching Ofir Pele, Michael Werman ECCV 2008

To get shorter running time, set the ground distance function to be a thresholded distance. For example: min(L2, T). Where T is some threshold. Note that the running time is shorter with smaller T values. Note also that thresholding the distance will probably increase accuracy. Finally, a thresholded metric is also a metric. See paper: Fast and Robust Earth Mover's Distances Ofir Pele, Michael Werman ICCV 2009

If you use this code, please cite the papers.

Parameters
signature1The first signature
signature2The second signature
extraMassPenaltyThe penalty for extra mass. If you want the resulting distance to be a metric, it should be at least half the diameter of the space (maximum possible distance between any two points). If you want partial matching you can set it to zero (but then the resulting distance is not guaranteed to be a metric). Default value is -1 which means the mass penalty is set to the maximum ground-distance between the two signatures. See also the 'emdHat' function.
Returns
the calculated EMD