better metric

master
Ondřej Hruška 9 years ago
parent 7d5c538bd3
commit f72be0afaa
  1. 6
      main.c
  2. 5
      src/vec_match.c

@ -14,7 +14,7 @@ static float reference[DATA_LEN] = {
static float data[DATA_LEN] = { static float data[DATA_LEN] = {
//0, 10, 20, 30, 40, 50, 50, 35, 15, 15, 0 //0, 10, 20, 30, 40, 50, 50, 35, 15, 15, 0
0, 13, 16, 0, 0.1, 0.2, 10, 0, 24, 0, 0, 7, 12, 0.4, 0.5, 0 0, 15.7, 0, 0, 0.3, 0.2, 0.1, 7, 24.242, 7, 0, 2, 0.2, 0.4, 0.5, 0
}; };
static float ref_p[REF_LEN]; static float ref_p[REF_LEN];
@ -78,14 +78,14 @@ int main(void)
vec_fuzzymatch_cfg_t cfg = { vec_fuzzymatch_cfg_t cfg = {
.length = DATA_LEN, .length = DATA_LEN,
.drift_x = 1, .drift_x = 1,
.offset_y = 1, .offset_y = 0.5,
.abs_threshold = 0.1 .abs_threshold = 0.1
}; };
vec_hausdorff_cfg_t cfg_hdf = { vec_hausdorff_cfg_t cfg_hdf = {
.length = DATA_LEN, .length = DATA_LEN,
.max_drift_x = 10, .max_drift_x = 4,
.cost_x = 10, .cost_x = 10,
.cost_y = 4 .cost_y = 4
}; };

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

Loading…
Cancel
Save