annotate 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
rev   line source
map01bf@255 1 #ifndef _EMD_H
map01bf@255 2 #define _EMD_H
map01bf@255 3 /*
map01bf@255 4 emd.h
map01bf@255 5
map01bf@255 6 Last update: 3/24/98
map01bf@255 7
map01bf@255 8 An implementation of the Earth Movers Distance.
map01bf@255 9 Based of the solution for the Transportation problem as described in
map01bf@255 10 "Introduction to Mathematical Programming" by F. S. Hillier and
map01bf@255 11 G. J. Lieberman, McGraw-Hill, 1990.
map01bf@255 12
map01bf@255 13 Copyright (C) 1998 Yossi Rubner
map01bf@255 14 Computer Science Department, Stanford University
map01bf@255 15 E-Mail: rubner@cs.stanford.edu URL: http://vision.stanford.edu/~rubner
map01bf@255 16 */
map01bf@255 17
map01bf@255 18
map01bf@255 19 /* DEFINITIONS */
map01bf@255 20 #define MAX_SIG_SIZE 100
map01bf@255 21 #define MAX_ITERATIONS 500
map01bf@255 22 #define INFINITY 1e22
map01bf@255 23 #define EPSILON 1e-6
map01bf@255 24
map01bf@255 25 /*****************************************************************************/
map01bf@255 26 /* feature_t SHOULD BE MODIFIED BY THE USER TO REFLECT THE FEATURE TYPE */
map01bf@255 27 /*Attempting to get this to work for gmms
map01bf@255 28 * here is how this is going to work:
map01bf@255 29 * each component has 2 arrays of doubles, the vector describing the mean and vector describing covar
map01bf@255 30 * also the struct has an int defining how many dimensions are in each component*/
map01bf@255 31 //also I need to sort out dimension generalized euclidean distance, though this shouldn't be too hard...
map01bf@255 32 typedef struct {
map01bf@255 33 int numdims;
map01bf@255 34 double *means, *covar;//these should both contain a vector of numdims doubles
map01bf@255 35 } feature_t;
map01bf@255 36 /*****************************************************************************/
map01bf@255 37
map01bf@255 38
map01bf@255 39 typedef struct
map01bf@255 40 {
map01bf@255 41 int n; /* Number of features in the signature */
map01bf@255 42 feature_t *Features; /* Pointer to the features vector */
map01bf@255 43 float *Weights; /* Pointer to the weights of the features */
map01bf@255 44 } signature_t;
map01bf@255 45
map01bf@255 46
map01bf@255 47 typedef struct
map01bf@255 48 {
map01bf@255 49 int from; /* Feature number in signature 1 */
map01bf@255 50 int to; /* Feature number in signature 2 */
map01bf@255 51 float amount; /* Amount of flow from "from" to "to" */
map01bf@255 52 } flow_t;
map01bf@255 53
map01bf@255 54
map01bf@255 55
map01bf@255 56 float emd(signature_t *Signature1, signature_t *Signature2,
map01bf@255 57 float (*func)(feature_t *, feature_t *),
map01bf@255 58 flow_t *Flow, int *FlowSize);
map01bf@255 59
map01bf@255 60 #endif