Visualization 2 - Lab Course
Main Page
Classes
Files
File List
All
Classes
Functions
Enumerations
Enumerator
src
emd.h
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
Permission is hereby granted, free of charge, to any person obtaining a copy
18
of this software and associated documentation files (the "Software"), to deal
19
in the Software without restriction, including without limitation the rights
20
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21
copies of the Software, and to permit persons to whom the Software is
22
furnished to do so, subject to the following conditions:
23
24
The above copyright notice and this permission notice shall be included in
25
all copies or substantial portions of the Software.
26
27
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
33
THE SOFTWARE.
34
35
*/
36
37
38
/* DEFINITIONS */
39
#define MAX_SIG_SIZE 100
40
#define MAX_ITERATIONS 500
41
#define INFINITY 1e20
42
#define EPSILON 1e-6
43
44
/*****************************************************************************/
45
/* feature_t SHOULD BE MODIFIED BY THE USER TO REFLECT THE FEATURE TYPE */
46
typedef
struct
{
47
int
r;
48
int
g;
49
int
b;
50
}
feature_t
;
51
/*****************************************************************************/
52
53
54
typedef
struct
55
{
56
int
n;
/* Number of features in the signature */
57
feature_t
*Features;
/* Pointer to the features vector */
58
float
*Weights;
/* Pointer to the weights of the features */
59
}
signature_t
;
60
61
62
typedef
struct
63
{
64
int
from;
/* Feature number in signature 1 */
65
int
to;
/* Feature number in signature 2 */
66
float
amount;
/* Amount of flow from "from" to "to" */
67
}
flow_t
;
68
69
70
71
float
emd(
signature_t
*Signature1,
signature_t
*Signature2,
72
float
(*func)(
feature_t
*,
feature_t
*),
73
flow_t
*Flow,
int
*FlowSize);
74
75
#endif
Generated on Tue Jun 11 2013 21:14:29 for Visualization 2 - Lab Course by
1.8.4