X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=images%2Fsignature.h;h=5e3647d1d02e24d965cae6170ee8f1fc75cc2232;hb=94022b1a1e317871b302946b595b2e890f4f1853;hp=597e016d6dc57493c78fe33339d180419d2f6abe;hpb=f0a4d5cf71aa209c5d2d69abcef85d6c0e27ccb8;p=libucw.git diff --git a/images/signature.h b/images/signature.h index 597e016d..5e3647d1 100644 --- a/images/signature.h +++ b/images/signature.h @@ -5,12 +5,16 @@ extern uns image_sig_min_width, image_sig_min_height; 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_border_size; +extern int image_sig_border_bonus; +extern double image_sig_inertia_scale[]; extern double image_sig_textured_threshold; -extern uns image_sig_compare_method; +extern int image_sig_compare_method; +extern uns image_sig_cmp_features_weights[]; #define IMAGE_VEC_F 6 #define IMAGE_REG_F IMAGE_VEC_F -#define IMAGE_REG_H 3 +#define IMAGE_REG_H 5 #define IMAGE_REG_MAX 16 /* K-dimensional feature vector (6 bytes) */ @@ -20,21 +24,24 @@ struct image_vector { /* Fetures for image regions (16 bytes) */ struct image_region { - byte f[IMAGE_VEC_F]; /* texture features */ - u16 h[IMAGE_REG_H]; /* shape features */ - u16 wa; /* normalized area percentage */ - u16 wb; /* normalized weight */ + byte f[IMAGE_VEC_F]; /* texture features - L, u, v, LH, HL, HH */ + byte h[IMAGE_REG_H]; /* shape/pos features - I1, I2, I3, X, Y */ + byte wa; /* normalized area percentage */ + byte wb; /* normalized weight */ + byte reserved[3]; } PACKED; #define IMAGE_SIG_TEXTURED 0x1 -/* Image signature (11 + len * 16 bytes) */ +/* Image signature (16 + len * 16 bytes) */ struct image_signature { byte len; /* Number of regions */ byte flags; /* IMAGE_SIG_xxx */ - byte df; /* Average f dist */ - u16 dh; /* Average h dist */ - struct image_vector vec; /* Combination of all regions... simple signature */ + u16 cols; /* Image width */ + u16 rows; /* Image height */ + u16 df; /* Average weighted f dist */ + u16 dh; /* Average weighted h dist */ + struct image_vector vec; /* Average features of all regions... simple signature */ struct image_region reg[IMAGE_REG_MAX];/* Feature vector for every region */ } PACKED; @@ -53,7 +60,7 @@ struct image_cluster { static inline uns image_signature_size(uns len) { - return 5 + sizeof(struct image_vector) + len * sizeof(struct image_region); + return OFFSETOF(struct image_signature, reg) + len * sizeof(struct image_region); } /* sig-dump.c */ @@ -118,7 +125,7 @@ void image_sig_detect_textured(struct image_sig_data *data); /* sig-cmp.c */ uns image_signatures_dist(struct image_signature *sig1, struct image_signature *sig2); -uns image_signatures_dist_explain(struct image_signature *sig1, struct image_signature *sig2, struct fastbuf *fb); +uns image_signatures_dist_explain(struct image_signature *sig1, struct image_signature *sig2, void (*msg)(byte *text, void *param), void *param); #endif