CEDRIC  Revision_backup-2009-02
Classes | Public Member Functions | List of all members
EarthMoversDistance< T, F > Class Template Reference

C++ Template Wrapper for original Ansi C code from Yossi Rubner. More...

#include <EarthMoversDistance.h>

Public Member Functions

 EarthMoversDistance (const T &signature1, const T &signature2, const GroundDistance< F > &dist)
 Compute EMD between two signatures according to given GroundDistance. More...
 
float value () const
 Returns value of optimal solution. More...
 

Detailed Description

template<class T, class F>
class EarthMoversDistance< T, F >

C++ Template Wrapper for original Ansi C code from Yossi Rubner.

Author
Max Hermann <mhermann[at]mail.cern.ch>

These is a slightly adjusted version of code from Yossi Rubner, where the main routines are unchanged, i also left the original comments. So please note the original comment from EMD.h:

   emd.h

   Last update: 3/24/98

   An implementation of the Earth Movers Distance.
   Based of the solution for the Transportation problem as described in
   "Introduction to Mathematical Programming" by F. S. Hillier and 
   G. J. Lieberman, McGraw-Hill, 1990.

   Copyright (C) 1998 Yossi Rubner
   Computer Science Department, Stanford University
   E-Mail: rubner@cs.stanford.edu   URL: http://vision.stanford.edu/~rubner 

Signature type class T must supply following members

int T::numFeatures() const; // returns number of features
const F& T::feature( int i ) const; // returns feature #i
float T::weight ( int i ) const; // returns weight for feature #i

where feature type class F can be arbitrary. I didn't use a abstract base class as interface for T out of performance considerations.

Todo:

Make getter not only for optimal solution value but also for optimal flow assignment

Get rid of second template parameter, it's redundant in current implementation

Throw proper exceptions instead of just error-strings

Constructor & Destructor Documentation

template<class T , class F >
EarthMoversDistance< T, F >::EarthMoversDistance ( const T &  signature1,
const T &  signature2,
const GroundDistance< F > &  dist 
)

Compute EMD between two signatures according to given GroundDistance.

Member Function Documentation

template<class T , class F >
float EarthMoversDistance< T, F >::value ( ) const
inline

Returns value of optimal solution.

Referenced by EventNavigator::computeClustering(), EventMap::create(), and EventNavigator::immerse().