Mercurial > hg > audiodb
view emd.h @ 258:d12364d8b9ea adding-emd
added cmdline stubs for distance switch and skeleton methods for EMD
author | map01bf |
---|---|
date | Fri, 25 Apr 2008 17:40:19 +0000 |
parents | bfd34e8c84fb |
children |
line wrap: on
line source
#ifndef _EMD_H #define _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 */ /* DEFINITIONS */ #define MAX_SIG_SIZE 100 #define MAX_ITERATIONS 500 #define INFINITY 1e22 #define EPSILON 1e-6 /*****************************************************************************/ /* feature_t SHOULD BE MODIFIED BY THE USER TO REFLECT THE FEATURE TYPE */ /*Attempting to get this to work for gmms * here is how this is going to work: * each component has 2 arrays of doubles, the vector describing the mean and vector describing covar * also the struct has an int defining how many dimensions are in each component*/ //also I need to sort out dimension generalized euclidean distance, though this shouldn't be too hard... typedef struct { int numdims; double *means, *covar;//these should both contain a vector of numdims doubles } feature_t; /*****************************************************************************/ typedef struct { int n; /* Number of features in the signature */ feature_t *Features; /* Pointer to the features vector */ float *Weights; /* Pointer to the weights of the features */ } signature_t; typedef struct { int from; /* Feature number in signature 1 */ int to; /* Feature number in signature 2 */ float amount; /* Amount of flow from "from" to "to" */ } flow_t; float emd(signature_t *Signature1, signature_t *Signature2, float (*func)(feature_t *, feature_t *), flow_t *Flow, int *FlowSize); #endif