00001
00019 #ifndef INTMATCHER_H
00020 #define INTMATCHER_H
00021
00022
00023
00024
00025 #include "debug.h"
00026 #include "intproto.h"
00027 #include "cutoffs.h"
00028
00037 typedef struct
00038 {
00040 FLOAT32 Rating;
00042 UINT8 Config;
00044 UINT8 Config2;
00045 } INT_RESULT_STRUCT, *INT_RESULT;
00046
00051 typedef struct
00052 {
00053 FLOAT32 Rating;
00054 FLOAT32 Rating2;
00055 UINT32 config_mask;
00056 CLASS_ID Class;
00057 } CP_RESULT_STRUCT;
00058
00059
00064 typedef CP_RESULT_STRUCT CLASS_PRUNER_RESULTS[MAX_NUM_CLASSES];
00065
00074 typedef UINT8 CLASS_NORMALIZATION_ARRAY[MAX_NUM_CLASSES];
00075
00076
00077
00078
00080 extern int AdaptProtoThresh;
00082 extern int AdaptFeatureThresh;
00083
00084
00085
00086
00087 int ClassPruner(INT_TEMPLATES IntTemplates,
00088 INT16 NumFeatures,
00089 INT_FEATURE_ARRAY Features,
00090 CLASS_NORMALIZATION_ARRAY NormalizationFactors,
00091 CLASS_CUTOFF_ARRAY ExpectedNumFeatures,
00092 CLASS_PRUNER_RESULTS Results,
00093 int Debug);
00094
00095 int feature_pruner(INT_TEMPLATES IntTemplates,
00096 INT16 NumFeatures,
00097 INT_FEATURE_ARRAY Features,
00098 INT32 NumClasses,
00099 CLASS_PRUNER_RESULTS Results);
00100
00101 int prune_configs(INT_TEMPLATES IntTemplates,
00102 INT32 min_misses,
00103 INT16 NumFeatures,
00104 INT_FEATURE_ARRAY Features,
00105 CLASS_NORMALIZATION_ARRAY NormalizationFactors,
00106 INT32 class_count,
00107 UINT16 BlobLength,
00108 CLASS_PRUNER_RESULTS Results,
00109 int Debug);
00110
00111 void PruningMatcher(INT_CLASS ClassTemplate,
00112 UINT16 BlobLength,
00113 INT16 NumFeatures,
00114 INT_FEATURE_ARRAY Features,
00115 INT32 min_misses,
00116 UINT8 NormalizationFactor,
00117 INT_RESULT Result,
00118 int Debug);
00119
00120 void config_mask_to_proto_mask(INT_CLASS ClassTemplate,
00121 BIT_VECTOR config_mask,
00122 BIT_VECTOR proto_mask);
00123
00124 void IntegerMatcher(INT_CLASS ClassTemplate,
00125 BIT_VECTOR ProtoMask,
00126 BIT_VECTOR ConfigMask,
00127 UINT16 BlobLength,
00128 INT16 NumFeatures,
00129 INT_FEATURE_ARRAY Features,
00130 INT32 min_misses,
00131 UINT8 NormalizationFactor,
00132 INT_RESULT Result,
00133 int Debug);
00134
00135 int FindGoodProtos(INT_CLASS ClassTemplate,
00136 BIT_VECTOR ProtoMask,
00137 BIT_VECTOR ConfigMask,
00138 UINT16 BlobLength,
00139 INT16 NumFeatures,
00140 INT_FEATURE_ARRAY Features,
00141 PROTO_ID *ProtoArray,
00142 int Debug);
00143
00144 int FindBadFeatures(INT_CLASS ClassTemplate,
00145 BIT_VECTOR ProtoMask,
00146 BIT_VECTOR ConfigMask,
00147 UINT16 BlobLength,
00148 INT16 NumFeatures,
00149 INT_FEATURE_ARRAY Features,
00150 FEATURE_ID *FeatureArray,
00151 int Debug);
00152
00153 void InitIntegerMatcher();
00154
00155 void InitIntegerMatcherVars();
00156
00157 void PrintIntMatcherStats(FILE *f);
00158
00159 void SetProtoThresh(FLOAT32 Threshold);
00160
00161 void SetFeatureThresh(FLOAT32 Threshold);
00162
00163 void SetBaseLineMatch();
00164
00165 void SetCharNormMatch();
00166
00167
00168
00169
00170 void IMClearTables (INT_CLASS ClassTemplate,
00171 int SumOfFeatureEvidence[MAX_NUM_CONFIGS],
00172 UINT8 ProtoEvidence[MAX_NUM_PROTOS][MAX_PROTO_INDEX]);
00173
00174 void IMClearFeatureEvidenceTable (UINT8 FeatureEvidence[MAX_NUM_CONFIGS],
00175 int NumConfigs);
00176
00177 void IMDebugConfiguration(INT_FEATURE FeatureNum,
00178 UINT16 ActualProtoNum,
00179 UINT8 Evidence,
00180 BIT_VECTOR ConfigMask,
00181 UINT32 ConfigWord);
00182
00183 void IMDebugConfigurationSum(INT_FEATURE FeatureNum,
00184 UINT8 *FeatureEvidence,
00185 INT32 ConfigCount);
00186
00187 void PMUpdateTablesForFeature (INT_CLASS ClassTemplate,
00188 int FeatureNum,
00189 INT_FEATURE Feature,
00190 UINT8 FeatureEvidence[MAX_NUM_CONFIGS],
00191 int SumOfFeatureEvidence[MAX_NUM_CONFIGS],
00192 int Debug);
00193
00194 void IMUpdateTablesForFeature (INT_CLASS ClassTemplate,
00195 BIT_VECTOR ProtoMask,
00196 BIT_VECTOR ConfigMask,
00197 int FeatureNum,
00198 INT_FEATURE Feature,
00199 UINT8 FeatureEvidence[MAX_NUM_CONFIGS],
00200 int SumOfFeatureEvidence[MAX_NUM_CONFIGS],
00201 UINT8
00202 ProtoEvidence[MAX_NUM_PROTOS][MAX_PROTO_INDEX],
00203 int Debug);
00204
00205 #ifndef GRAPHICS_DISABLED
00206 void IMDebugFeatureProtoError (INT_CLASS ClassTemplate,
00207 BIT_VECTOR ProtoMask,
00208 BIT_VECTOR ConfigMask,
00209 int SumOfFeatureEvidence[MAX_NUM_CONFIGS],
00210 UINT8
00211 ProtoEvidence[MAX_NUM_PROTOS][MAX_PROTO_INDEX],
00212 INT16 NumFeatures, int Debug);
00213
00214 void IMDisplayProtoDebugInfo (INT_CLASS ClassTemplate,
00215 BIT_VECTOR ProtoMask,
00216 BIT_VECTOR ConfigMask,
00217 UINT8
00218 ProtoEvidence[MAX_NUM_PROTOS][MAX_PROTO_INDEX],
00219 int Debug);
00220
00221 void IMDisplayFeatureDebugInfo(INT_CLASS ClassTemplate,
00222 BIT_VECTOR ProtoMask,
00223 BIT_VECTOR ConfigMask,
00224 INT16 NumFeatures,
00225 INT_FEATURE_ARRAY Features,
00226 int Debug);
00227 #endif
00228
00229 void IMUpdateSumOfProtoEvidences (INT_CLASS ClassTemplate,
00230 BIT_VECTOR ConfigMask,
00231 int SumOfFeatureEvidence[MAX_NUM_CONFIGS],
00232 UINT8
00233 ProtoEvidence[MAX_NUM_PROTOS]
00234 [MAX_PROTO_INDEX], INT16 NumFeatures);
00235
00236 void PMNormalizeSumOfEvidences (INT_CLASS ClassTemplate,
00237 int SumOfFeatureEvidence[MAX_NUM_CONFIGS],
00238 INT16 NumFeatures, INT32 used_features);
00239
00240 void IMNormalizeSumOfEvidences (INT_CLASS ClassTemplate,
00241 int SumOfFeatureEvidence[MAX_NUM_CONFIGS],
00242 INT16 NumFeatures, INT32 used_features);
00243
00244 int IMFindBestMatch (INT_CLASS ClassTemplate,
00245 int SumOfFeatureEvidence[MAX_NUM_CONFIGS],
00246 UINT16 BlobLength,
00247 UINT8 NormalizationFactor, INT_RESULT Result);
00248
00249 #ifndef GRAPHICS_DISABLED
00250 void IMDebugBestMatch(int BestMatch,
00251 INT_RESULT Result,
00252 UINT16 BlobLength,
00253 UINT8 NormalizationFactor);
00254 #endif
00255
00256 void HeapSort (int n, register INT16 ra[], register UINT8 rb[]);
00257
00258
00259
00260
00261 extern int IntegerMatcherMultiplier;
00262
00263 extern UINT32 EvidenceMultMask;
00264 #endif