Browse Source

better metric

Ondřej Hruška 6 years ago
parent
commit
f72be0afaa
2 changed files with 5 additions and 6 deletions
  1. 3 3
      main.c
  2. 2 3
      src/vec_match.c

+ 3 - 3
main.c View File

@@ -14,7 +14,7 @@ static float reference[DATA_LEN] = {
14 14
 
15 15
 static float data[DATA_LEN] = {
16 16
 	//0, 10, 20, 30, 40, 50, 50, 35, 15, 15, 0
17
-	0, 13, 16, 0, 0.1, 0.2, 10, 0, 24, 0, 0, 7, 12, 0.4, 0.5, 0
17
+	0, 15.7, 0, 0, 0.3, 0.2, 0.1, 7, 24.242, 7, 0, 2, 0.2, 0.4, 0.5, 0
18 18
 };
19 19
 
20 20
 static float ref_p[REF_LEN];
@@ -78,14 +78,14 @@ int main(void)
78 78
 	vec_fuzzymatch_cfg_t cfg = {
79 79
 		.length = DATA_LEN,
80 80
 		.drift_x = 1,
81
-		.offset_y = 1,
81
+		.offset_y = 0.5,
82 82
 		.abs_threshold = 0.1
83 83
 	};
84 84
 
85 85
 
86 86
 	vec_hausdorff_cfg_t cfg_hdf = {
87 87
 		.length = DATA_LEN,
88
-		.max_drift_x = 10,
88
+		.max_drift_x = 4,
89 89
 		.cost_x = 10,
90 90
 		.cost_y = 4
91 91
 	};

+ 2 - 3
src/vec_match.c View File

@@ -20,7 +20,7 @@
20 20
 
21 21
 // ---- HAUSDORFF ----
22 22
 
23
-// real hausdorf should just return the max distance, we sum them all
23
+// real hausdorf should just return the highest minimal distance, we sum them.
24 24
 float vec_hausdorff_do(const float *data,
25 25
 					   const float *ref, uint32_t ref_p_len,
26 26
 					   const vec_hausdorff_cfg_t *cfg, bool packed)
@@ -59,8 +59,7 @@ float vec_hausdorff_do(const float *data,
59 59
 			f = packed ? pw_get(&w, j) : ref[j];
60 60
 
61 61
 			// get X dist
62
-			g = sqrtf(SQ((f - data[i]) * cfg->cost_y) +
63
-					  SQ(NUM_DIST(i, j) * cfg->cost_x));
62
+			g = SQ((f - data[i]) * cfg->cost_y) + SQ(NUM_DIST(i, j) * cfg->cost_x);//sqrtf(
64 63
 
65 64
 			if (dist > g) dist = g;
66 65
 		}