source:cpp/frams/model/similarity/EMD/emd.h@1062

Last change on this file since 1062 was 1062, checked in by oriona, 2 years ago

Global arrays moved to emd function.

File size: 1.4 KB
Line
1#ifndef _EMD_H
2#define _EMD_H
3/*
4    emd.h
5
6    Last update: 3/24/98
7
8    An implementation of the Earth Movers Distance.
9    Based of the solution for the Transportation problem as described in
10    "Introduction to Mathematical Programming" by F. S. Hillier and
11    G. J. Lieberman, McGraw-Hill, 1990.
12
13    Copyright (C) 1998 Yossi Rubner
14    Computer Science Department, Stanford University
15    E-Mail: rubner@cs.stanford.edu   URL: http://vision.stanford.edu/~rubner
16*/
17
18/* DEFINITIONS */
19#define MAX_ITERATIONS 500
20//#define INFINITY       1e20
21#define EPSILON        1e-6
22
23/*****************************************************************************/
24/* feature_t SHOULD BE MODIFIED BY THE USER TO REFLECT THE FEATURE TYPE      */
25//typedef struct {
26//   double X,Y,Z;
27//}
28typedef double feature_t;
29/*****************************************************************************/
30
31
32typedef struct
33{
34  int n;                /* Number of features in the signature */
35  feature_t *Features;  /* Pointer to the features vector */
36  float *Weights;       /* Pointer to the weights of the features */
37} signature_t;
38
39
40typedef struct
41{
42  int from;             /* Feature number in signature 1 */
43  int to;               /* Feature number in signature 2 */
44  float amount;         /* Amount of flow from "from" to "to" */
45} flow_t;
46
47
48
49float emd(signature_t *Signature1, signature_t *Signature2,
50          float (*func)(feature_t *, feature_t *),
51          flow_t *Flow, int *FlowSize);
52
53#endif
Note: See TracBrowser for help on using the repository browser.