CompareMethod 2
+# Array of multiplicative constants in feature vectors distance computation
+# (L, u, v, LH, HL, HH, H0, H1, H2). Each one must be in range 0..15.
+CompareFeaturesWeights 1 2 2 1 1 1 1 1 1
+
}
######## Duplicates finder ######################################################
uns image_sig_postquant_threshold;
double image_sig_textured_threshold;
uns image_sig_compare_method;
+uns image_sig_cmp_features_weights[IMAGE_VEC_F + IMAGE_REG_H];
static struct cf_section sig_config = {
CF_ITEMS{
CF_UNS("PostQuantThreshold", &image_sig_postquant_threshold),
CF_DOUBLE("TexturedThreshold", &image_sig_textured_threshold),
CF_UNS("CompareMethod", &image_sig_compare_method),
+ CF_UNS_ARY("CompareFeaturesWeights", image_sig_cmp_features_weights, IMAGE_VEC_F + IMAGE_REG_H),
CF_END
}
};
for (i = 0, reg1 = sig1->reg; i < sig1->len; i++, reg1++)
{
uns ds =
- isqr((int)reg1->h[0] - (int)reg2->h[0]) +
- isqr((int)reg1->h[1] - (int)reg2->h[1]) +
- isqr((int)reg1->h[2] - (int)reg2->h[2]);
+ image_sig_cmp_features_weights[6] * isqr((int)reg1->h[0] - (int)reg2->h[0]) +
+ image_sig_cmp_features_weights[7] * isqr((int)reg1->h[1] - (int)reg2->h[1]) +
+ image_sig_cmp_features_weights[8] * isqr((int)reg1->h[2] - (int)reg2->h[2]);
uns dt =
- isqr((int)reg1->f[0] - (int)reg2->f[0]) +
- isqr((int)reg1->f[1] - (int)reg2->f[1]) +
- isqr((int)reg1->f[2] - (int)reg2->f[2]) +
- isqr((int)reg1->f[3] - (int)reg2->f[3]) +
- isqr((int)reg1->f[4] - (int)reg2->f[4]) +
- isqr((int)reg1->f[5] - (int)reg2->f[5]);
+ image_sig_cmp_features_weights[0] * isqr((int)reg1->f[0] - (int)reg2->f[0]) +
+ image_sig_cmp_features_weights[1] * isqr((int)reg1->f[1] - (int)reg2->f[1]) +
+ image_sig_cmp_features_weights[2] * isqr((int)reg1->f[2] - (int)reg2->f[2]) +
+ image_sig_cmp_features_weights[3] * isqr((int)reg1->f[3] - (int)reg2->f[3]) +
+ image_sig_cmp_features_weights[4] * isqr((int)reg1->f[4] - (int)reg2->f[4]) +
+ image_sig_cmp_features_weights[5] * isqr((int)reg1->f[5] - (int)reg2->f[5]);
if (ds < 1000)
dt *= 8;
else if (ds < 10000)
for (i = 0, reg1 = sig1->reg; i < sig1->len; i++, reg1++)
{
uns dt =
- isqr((int)reg1->f[0] - (int)reg2->f[0]) +
- isqr((int)reg1->f[1] - (int)reg2->f[1]) +
- isqr((int)reg1->f[2] - (int)reg2->f[2]) +
- isqr((int)reg1->f[3] - (int)reg2->f[3]) +
- isqr((int)reg1->f[4] - (int)reg2->f[4]) +
- isqr((int)reg1->f[5] - (int)reg2->f[5]);
+ image_sig_cmp_features_weights[0] * isqr((int)reg1->f[0] - (int)reg2->f[0]) +
+ image_sig_cmp_features_weights[1] * isqr((int)reg1->f[1] - (int)reg2->f[1]) +
+ image_sig_cmp_features_weights[2] * isqr((int)reg1->f[2] - (int)reg2->f[2]) +
+ image_sig_cmp_features_weights[3] * isqr((int)reg1->f[3] - (int)reg2->f[3]) +
+ image_sig_cmp_features_weights[4] * isqr((int)reg1->f[4] - (int)reg2->f[4]) +
+ image_sig_cmp_features_weights[5] * isqr((int)reg1->f[5] - (int)reg2->f[5]);
dist[n++] = (dt << 12) + i + (j << 4);
DBG("[%u, %u] dt=%u", i, j, dt);
MSG("[%u, %u] dt=%u", i, j, dt);
extern uns *image_sig_prequant_thresholds;
extern uns image_sig_postquant_min_steps, image_sig_postquant_max_steps, image_sig_postquant_threshold;
extern double image_sig_textured_threshold;
-extern uns image_sig_compare_method;
+extern uns image_sig_compare_method, image_sig_cmp_features_weights[];
#define IMAGE_VEC_F 6
#define IMAGE_REG_F IMAGE_VEC_F