#include "matchdefs.h"
#include "protos.h"
#include "callcpp.h"
Go to the source code of this file.
#define ANGLE_SHIFT (0.0) |
Coordinate system offsets for each table parameter
Definition at line 35 of file intproto.h.
Referenced by AddProtoToProtoPruner(), and ComputeIntFeatures().
#define BITS_PER_CP_VECTOR (CLASSES_PER_CP * NUM_BITS_PER_CLASS) |
Definition at line 60 of file intproto.h.
#define BITS_PER_WERD (8 * sizeof (UINT32)) |
Definition at line 41 of file intproto.h.
#define CLASSES_PER_CP 32 |
FIX:
Definition at line 56 of file intproto.h.
#define CLASSES_PER_CP_WERD (CLASSES_PER_CP / NUM_BITS_PER_CLASS) |
#define ClassForClassId | ( | T, | |||
C | ) | (ClassForIndex (T, IndexForClassId (T, C))) |
Definition at line 232 of file intproto.h.
Referenced by AdaptToChar(), AddNewResult(), AmbigClassifier(), BaselineClassifier(), CharNormClassifier(), compare_tess_blobs(), GetBestRatingFor(), MakeNewAdaptedClass(), MakeNewTemporaryConfig(), and ShowBestMatchFor().
#define ClassForIndex | ( | T, | |||
I | ) | ((T)->Class[I]) |
Definition at line 231 of file intproto.h.
Referenced by AddIntClass(), BaselineClassifier(), free_int_templates(), make_config_pruner(), PrintAdaptedTemplates(), prune_configs(), ReadIntTemplates(), WriteAdaptedTemplates(), WriteIntTemplates(), and WritePFFMTable().
#define ClassIdForIndex | ( | T, | |||
I | ) | ((T)->ClassIdFor[I]) |
Definition at line 227 of file intproto.h.
Referenced by AddIntClass(), ClassPruner(), ComputeIntCharNormArray(), InitAdaptiveClassifier(), NewIntTemplates(), PrintAdaptedTemplates(), and WritePFFMTable().
#define ClassPrunersFor | ( | T | ) | ((T)->ClassPruner) |
#define CLIP_MATCH_EVIDENCE 0x020 |
Definition at line 246 of file intproto.h.
#define ClipMatchEvidenceOn | ( | D | ) | ((D) & CLIP_MATCH_EVIDENCE) |
Definition at line 254 of file intproto.h.
Referenced by IMDisplayFeatureDebugInfo(), and IMDisplayProtoDebugInfo().
#define CPrunerBitIndexFor | ( | I | ) | (((I) % CLASSES_PER_CP) % CLASSES_PER_CP_WERD) |
Definition at line 237 of file intproto.h.
#define CPrunerFor | ( | T, | |||
I | ) | ((T)->ClassPruner [CPrunerIdFor (I)]) |
#define CPrunerIdFor | ( | I | ) | ((I) / CLASSES_PER_CP) |
Definition at line 234 of file intproto.h.
#define CPrunerMaskFor | ( | L, | |||
I | ) | (((L)+1) << CPrunerBitIndexFor (I) * NUM_BITS_PER_CLASS) |
#define CPrunerWordIndexFor | ( | I | ) | (((I) % CLASSES_PER_CP) / CLASSES_PER_CP_WERD) |
#define DISPLAY_FEATURE_MATCHES 0x002 |
Definition at line 242 of file intproto.h.
#define DISPLAY_PROTO_MATCHES 0x004 |
Definition at line 243 of file intproto.h.
#define DisplayFeatureMatchesOn | ( | D | ) | ((D) & DISPLAY_FEATURE_MATCHES) |
#define DisplayProtoMatchesOn | ( | D | ) | ((D) & DISPLAY_PROTO_MATCHES) |
#define IndexForClassId | ( | T, | |||
C | ) | ((T)->IndexFor[C]) |
Definition at line 228 of file intproto.h.
Referenced by AdaptToChar(), AddIntClass(), AddProtoToClassPruner(), AmbigClassifier(), BaselineClassifier(), CharNormClassifier(), feature_pruner(), GetBestRatingFor(), InitAdaptiveClassifier(), MakeNewAdaptedClass(), MakeNewTemporaryConfig(), MakePermanent(), MakeTempProtoPerm(), NewIntTemplates(), prune_configs(), and ShowBestMatchFor().
#define IndexForProto | ( | P | ) | (P % PROTOS_PER_PROTO_SET) |
Definition at line 212 of file intproto.h.
Referenced by AddProtoToProtoPruner(), and RenderIntProto().
#define INT_CHAR_NORM_RANGE 256 |
definitions of integer features
Definition at line 173 of file intproto.h.
Referenced by ComputeIntCharNormArray(), RenderIntFeature(), and RenderIntProto().
#define LegalClassId | ( | C | ) | ((C) > 0 && (C) < MAX_CLASS_ID) |
Definition at line 229 of file intproto.h.
Referenced by AdaptToChar(), AddAdaptedClass(), AddIntClass(), GetBestRatingFor(), and ShowBestMatchFor().
#define LengthForConfigId | ( | C, | |||
c | ) | ((C)->ConfigLengths[c]) |
Definition at line 217 of file intproto.h.
Referenced by AddIntConfig(), ConvertConfig(), IMDebugFeatureProtoError(), IMNormalizeSumOfEvidences(), and WritePFFMTable().
#define LengthForProtoId | ( | C, | |||
P | ) | ((C)->ProtoLengths[P]) |
Definition at line 216 of file intproto.h.
Referenced by AddIntProto(), ConvertConfig(), ConvertProto(), FindGoodProtos(), IMDebugFeatureProtoError(), IMDisplayProtoDebugInfo(), IMUpdateSumOfProtoEvidences(), IMUpdateTablesForFeature(), and RenderIntProto().
#define MatchDebuggingOn | ( | D | ) | (D) |
Definition at line 248 of file intproto.h.
Referenced by FindBadFeatures(), FindGoodProtos(), IntegerMatcher(), and PruningMatcher().
#define MAX_NUM_CLASS_PRUNERS |
Value:
((MAX_NUM_CLASSES + CLASSES_PER_CP - 1) / \ CLASSES_PER_CP)
Definition at line 61 of file intproto.h.
Referenced by ReadIntTemplates().
#define MAX_NUM_CONFIGS 32 |
FIX:
Definition at line 43 of file intproto.h.
Referenced by AddIntConfig(), compare_tess_blobs(), FindBadFeatures(), FindGoodProtos(), free_adapted_class(), IMDisplayFeatureDebugInfo(), InitAdaptiveClassifier(), IntegerMatcher(), MakeNewTemporaryConfig(), NewAdaptedClass(), NewIntClass(), NewLabeledClass(), PruningMatcher(), ReadAdaptedClass(), ReadIntTemplates(), and WriteAdaptedClass().
#define MAX_NUM_INT_FEATURES 512 |
definitions of integer features
Definition at line 171 of file intproto.h.
Referenced by MakeNewTemporaryConfig(), and SaveFeature().
#define MAX_NUM_PROTO_SETS (MAX_NUM_PROTOS / PROTOS_PER_PROTO_SET) |
#define MAX_NUM_PROTOS 256 |
FIX:
Definition at line 45 of file intproto.h.
Referenced by AddIntProto(), compare_tess_blobs(), config_mask_to_proto_mask(), FindBadFeatures(), FindGoodProtos(), IMDisplayFeatureDebugInfo(), InitAdaptiveClassifier(), IntegerMatcher(), MakeNewTemporaryConfig(), NewAdaptedClass(), NewLabeledClass(), ReadAdaptedClass(), and WriteAdaptedClass().
#define MAX_PROTO_INDEX 24 |
FIX:
Definition at line 40 of file intproto.h.
Referenced by FindBadFeatures(), FindGoodProtos(), IMDisplayFeatureDebugInfo(), and IntegerMatcher().
#define MaxNumClassesIn | ( | T | ) | (NumClassPrunersIn (T) * CLASSES_PER_CP) |
#define MaxNumIntProtosIn | ( | C | ) | (NumProtoSetsIn (C) * PROTOS_PER_PROTO_SET) |
Definition at line 208 of file intproto.h.
Referenced by AddIntProto(), NewIntClass(), ReadIntTemplates(), and WriteIntTemplates().
#define NUM_BITS_PER_CLASS 2 |
Definition at line 57 of file intproto.h.
#define NUM_CP_BUCKETS 24 |
FIX:
Definition at line 54 of file intproto.h.
Referenced by ClassPruner(), DoFill(), feature_pruner(), and ReadIntTemplates().
#define NUM_PP_BUCKETS 64 |
FIX:
Definition at line 52 of file intproto.h.
Referenced by FillPPCircularBits(), FillPPLinearBits(), IMUpdateTablesForFeature(), make_config_pruner(), PMUpdateTablesForFeature(), ReadIntTemplates(), and RenderIntProto().
#define NUM_PP_PARAMS 3 |
#define NumClassesIn | ( | T | ) | ((T)->NumClasses) |
Definition at line 224 of file intproto.h.
Referenced by AddIntClass(), ClassPruner(), ClearCharNormArray(), ComputeIntCharNormArray(), feature_pruner(), free_adapted_templates(), free_int_templates(), InitAdaptiveClassifier(), make_config_pruner(), NewIntTemplates(), PrintAdaptedTemplates(), ReadAdaptedTemplates(), ReadIntTemplates(), WriteAdaptedTemplates(), WriteIntTemplates(), and WritePFFMTable().
#define NumClassPrunersIn | ( | T | ) | ((T)->NumClassPruners) |
Definition at line 225 of file intproto.h.
Referenced by AddIntClass(), ClassPruner(), feature_pruner(), free_int_templates(), NewIntTemplates(), ReadIntTemplates(), and WriteIntTemplates().
#define NumIntConfigsIn | ( | C | ) | ((C)->NumConfigs) |
Definition at line 209 of file intproto.h.
Referenced by AddIntConfig(), AddNewResult(), BaselineClassifier(), FindBadFeatures(), IMClearTables(), IMDebugFeatureProtoError(), IMDisplayFeatureDebugInfo(), IMFindBestMatch(), IMNormalizeSumOfEvidences(), IMUpdateTablesForFeature(), MakeNewTemporaryConfig(), NewIntClass(), PMNormalizeSumOfEvidences(), PMUpdateTablesForFeature(), PrintAdaptedTemplates(), PruningMatcher(), WriteAdaptedTemplates(), and WritePFFMTable().
#define NumIntProtosIn | ( | C | ) | ((C)->NumProtos) |
Definition at line 206 of file intproto.h.
Referenced by AddIntProto(), AddProtoToProtoPruner(), config_mask_to_proto_mask(), ConvertConfig(), ConvertProto(), FindGoodProtos(), IMClearTables(), IMDebugFeatureProtoError(), IMDisplayProtoDebugInfo(), IMUpdateSumOfProtoEvidences(), MakeNewTemporaryConfig(), MakeNewTempProtos(), NewIntClass(), PrintAdaptedTemplates(), and RenderIntProto().
#define NumProtoSetsIn | ( | C | ) | ((C)->NumProtoSets) |
Definition at line 207 of file intproto.h.
Referenced by AddIntProto(), config_mask_to_proto_mask(), free_int_class(), IMDebugFeatureProtoError(), IMDisplayProtoDebugInfo(), IMUpdateSumOfProtoEvidences(), IMUpdateTablesForFeature(), make_config_pruner(), NewIntClass(), PMUpdateTablesForFeature(), ReadIntTemplates(), and WriteIntTemplates().
#define PPrunerBitIndexFor | ( | I | ) | ((I) % PROTOS_PER_PP_WERD) |
Definition at line 220 of file intproto.h.
#define PPrunerMaskFor | ( | I | ) | (1 << PPrunerBitIndexFor (I)) |
#define PPrunerWordIndexFor | ( | I | ) |
Value:
(((I) % PROTOS_PER_PROTO_SET) / \ PROTOS_PER_PP_WERD)
Definition at line 218 of file intproto.h.
Referenced by RenderIntProto().
#define PRINT_FEATURE_MATCHES 0x008 |
#define PRINT_MATCH_SUMMARY 0x001 |
#define PRINT_PROTO_MATCHES 0x010 |
#define PrintFeatureMatchesOn | ( | D | ) | ((D) & PRINT_FEATURE_MATCHES) |
Definition at line 252 of file intproto.h.
Referenced by IMUpdateTablesForFeature(), and PMUpdateTablesForFeature().
#define PrintMatchSummaryOn | ( | D | ) | ((D) & PRINT_MATCH_SUMMARY) |
Definition at line 249 of file intproto.h.
Referenced by FindBadFeatures(), FindGoodProtos(), IMDebugFeatureProtoError(), IntegerMatcher(), and PruningMatcher().
#define PrintProtoMatchesOn | ( | D | ) | ((D) & PRINT_PROTO_MATCHES) |
Definition at line 253 of file intproto.h.
Referenced by FindBadFeatures(), FindGoodProtos(), IMDebugFeatureProtoError(), and IntegerMatcher().
#define ProtoForProtoId | ( | C, | |||
P | ) |
Value:
(&((ProtoSetIn (C, SetForProto (P)))-> \ Protos [IndexForProto (P)]))
Definition at line 214 of file intproto.h.
Referenced by AddIntProto(), ConvertConfig(), and ConvertProto().
#define ProtoPrunerFor | ( | S | ) | (S->ProtoPruner) |
PROTO_SET access macros
Definition at line 203 of file intproto.h.
Referenced by AddIntProto(), and NewIntClass().
#define PROTOS_PER_PP_WERD BITS_PER_WERD |
Definition at line 59 of file intproto.h.
#define PROTOS_PER_PROTO_SET 64 |
FIX:
Definition at line 47 of file intproto.h.
Referenced by config_mask_to_proto_mask(), IMDebugFeatureProtoError(), IMDisplayProtoDebugInfo(), IMUpdateSumOfProtoEvidences(), IMUpdateTablesForFeature(), make_config_pruner(), NewIntClass(), PMUpdateTablesForFeature(), and ReadIntTemplates().
#define ProtoSetIn | ( | C, | |||
I | ) | ((C)->ProtoSets[I]) |
Definition at line 210 of file intproto.h.
Referenced by AddIntProto(), AddProtoToProtoPruner(), config_mask_to_proto_mask(), free_int_class(), IMDebugFeatureProtoError(), IMDisplayProtoDebugInfo(), IMUpdateSumOfProtoEvidences(), IMUpdateTablesForFeature(), make_config_pruner(), NewIntClass(), PMUpdateTablesForFeature(), ReadIntTemplates(), RenderIntProto(), and WriteIntTemplates().
#define PRUNER_ANGLE 2 |
#define PRUNER_X 0 |
Order of params in pruners
Definition at line 30 of file intproto.h.
Referenced by AddProtoToProtoPruner(), and RenderIntProto().
#define PRUNER_Y 1 |
Definition at line 31 of file intproto.h.
Referenced by AddProtoToProtoPruner(), and RenderIntProto().
#define SetForProto | ( | P | ) | (P / PROTOS_PER_PROTO_SET) |
Definition at line 211 of file intproto.h.
Referenced by AddProtoToProtoPruner(), and RenderIntProto().
#define UnusedClassIdIn | ( | T, | |||
C | ) | (IndexForClassId (T,C) == ILLEGAL_CLASS) |
Definition at line 230 of file intproto.h.
Referenced by AdaptToChar(), AddAdaptedClass(), AddIntClass(), CreateIntTemplates(), GetBestRatingFor(), and ShowBestMatchFor().
#define WERDS_PER_CONFIG_VEC |
Value:
((MAX_NUM_CONFIGS + BITS_PER_WERD - 1) / \ BITS_PER_WERD)
Definition at line 70 of file intproto.h.
Referenced by AddIntProto(), and ReadIntTemplates().
#define WERDS_PER_CP |
#define WERDS_PER_CP_VECTOR (BITS_PER_CP_VECTOR / BITS_PER_WERD) |
Definition at line 63 of file intproto.h.
Referenced by ClassPruner(), feature_pruner(), and ReadIntTemplates().
#define WERDS_PER_PP |
#define WERDS_PER_PP_VECTOR |
#define X_SHIFT (0.5) |
Definition at line 36 of file intproto.h.
Referenced by AddProtoToProtoPruner(), and ComputeIntFeatures().
#define Y_SHIFT (0.5) |
Definition at line 37 of file intproto.h.
Referenced by AddProtoToProtoPruner(), and ComputeIntFeatures().
typedef UINT32(* CLASS_PRUNER)[NUM_CP_BUCKETS][NUM_CP_BUCKETS][WERDS_PER_CP_VECTOR] |
Definition at line 83 of file intproto.h.
FIX: Holds info for class pruner/operator that works on templates.
(fmg only) Templates->ClassPruner[Pruner] = @CLASS_PRUNER_STRUCT
Definition at line 80 of file intproto.h.
typedef struct INT_CLASS_STRUCT * INT_CLASS |
Array INT_FEATURE_STRUCT (set of features, see Glossary).
Definition at line 197 of file intproto.h.
typedef struct INT_PROTO_STRUCT * INT_PROTO |
typedef struct INT_TEMPLATES_STRUCT * INT_TEMPLATES |
typedef struct PROTO_SET_STRUCT * PROTO_SET |
int AddIntClass | ( | INT_TEMPLATES | Templates, | |
CLASS_ID | ClassId, | |||
INT_CLASS | Class | |||
) |
Adds a new class structure to a set of templates.
Templates | Templates to add new class to | |
ClassId | Class id to associate new class with | |
Class | Class data structure to add to templates |
Definition at line 289 of file intproto.cpp.
References assert(), ClassForIndex, ClassIdForIndex, Emalloc(), IndexForClassId, LegalClassId, MaxNumClassesIn, NumClassesIn, NumClassPrunersIn, UnusedClassIdIn, and WERDS_PER_CP.
Referenced by AddAdaptedClass(), and CreateIntTemplates().
00289 { 00290 int Index; 00291 int Pruner; 00292 UINT32 *Word; 00293 00294 assert (LegalClassId (ClassId)); 00295 assert (UnusedClassIdIn (Templates, ClassId)); 00296 00297 Index = NumClassesIn (Templates); 00298 IndexForClassId (Templates, ClassId) = Index; 00299 ClassIdForIndex (Templates, Index) = ClassId; 00300 00301 NumClassesIn (Templates)++; 00302 ClassForIndex (Templates, Index) = Class; 00303 00304 if (NumClassesIn (Templates) > MaxNumClassesIn (Templates)) { 00305 Pruner = NumClassPrunersIn (Templates); 00306 NumClassPrunersIn (Templates)++; 00307 Templates->ClassPruner[Pruner] = 00308 (CLASS_PRUNER) Emalloc (sizeof (CLASS_PRUNER_STRUCT)); 00309 00310 for (Word = (UINT32 *) (Templates->ClassPruner[Pruner]); 00311 Word < (UINT32 *) (Templates->ClassPruner[Pruner]) + WERDS_PER_CP; 00312 *Word++ = 0); 00313 } 00314 00315 return (Index); 00316 00317 } /* AddIntClass */
int AddIntConfig | ( | INT_CLASS | Class | ) |
Returns the index of the next free config in Class.
Class | Class to add new configuration to |
Definition at line 329 of file intproto.cpp.
References assert(), LengthForConfigId, MAX_NUM_CONFIGS, and NumIntConfigsIn.
Referenced by CreateIntTemplates(), MakeNewAdaptedClass(), and MakeNewTemporaryConfig().
00329 { 00330 int Index; 00331 00332 assert (NumIntConfigsIn (Class) < MAX_NUM_CONFIGS); 00333 00334 Index = NumIntConfigsIn (Class); 00335 NumIntConfigsIn (Class)++; 00336 LengthForConfigId (Class, Index) = 0; 00337 return (Index); 00338 } /* AddIntConfig */
int AddIntProto | ( | INT_CLASS | Class | ) |
Allocates the next free proto in Class and returns its index.
Class | Class to add new proto to |
Definition at line 350 of file intproto.cpp.
References Emalloc(), Erealloc(), LengthForProtoId, MAX_NUM_PROTOS, MaxNumIntProtosIn, NO_PROTO, NumIntProtosIn, NumProtoSetsIn, ProtoForProtoId, ProtoPrunerFor, ProtoSetIn, WERDS_PER_CONFIG_VEC, and WERDS_PER_PP.
Referenced by CreateIntTemplates(), MakeNewAdaptedClass(), and MakeNewTempProtos().
00350 { 00351 int Index; 00352 int ProtoSetId; 00353 PROTO_SET ProtoSet; 00354 INT_PROTO Proto; 00355 register UINT32 *Word; 00356 00357 if (NumIntProtosIn (Class) >= MAX_NUM_PROTOS) 00358 return (NO_PROTO); 00359 00360 Index = NumIntProtosIn (Class); 00361 NumIntProtosIn (Class)++; 00362 00363 if (NumIntProtosIn (Class) > MaxNumIntProtosIn (Class)) { 00364 ProtoSetId = NumProtoSetsIn (Class); 00365 NumProtoSetsIn (Class)++; 00366 00367 ProtoSet = (PROTO_SET) Emalloc (sizeof (PROTO_SET_STRUCT)); 00368 ProtoSetIn (Class, ProtoSetId) = ProtoSet; 00369 for (Word = (UINT32 *) (ProtoPrunerFor (ProtoSet)); 00370 Word < (UINT32 *) (ProtoPrunerFor (ProtoSet)) + WERDS_PER_PP; 00371 *Word++ = 0); 00372 00373 /* reallocate space for the proto lengths and install in class */ 00374 Class->ProtoLengths = (UINT8 *) Erealloc (Class->ProtoLengths, 00375 MaxNumIntProtosIn (Class) * 00376 sizeof (UINT8)); 00377 } 00378 00379 /* initialize proto so its length is zero and it isn't in any configs */ 00380 LengthForProtoId (Class, Index) = 0; 00381 Proto = ProtoForProtoId (Class, Index); 00382 for (Word = Proto->Configs; 00383 Word < Proto->Configs + WERDS_PER_CONFIG_VEC; *Word++ = 0); 00384 00385 return (Index); 00386 00387 } /* AddIntProto */
void AddProtoToClassPruner | ( | PROTO | Proto, | |
CLASS_ID | ClassId, | |||
INT_TEMPLATES | Templates | |||
) |
Adds Proto to the class pruning tables for the specified class in Templates.
Proto | Floating-pt proto to add to class pruner | |
ClassId | Class id corresponding to Proto | |
Templates | Set of templates containing class pruner |
Definition at line 404 of file intproto.cpp.
References CPrunerFor, CPrunerMaskFor, CPrunerWordIndexFor, DoFill(), FillerDone(), GetCPPadsForLevel(), GetNextFill(), IndexForClassId, InitTableFiller(), and MAX_LEVEL.
Referenced by CreateIntTemplates(), and MakeTempProtoPerm().
00406 { 00407 CLASS_PRUNER Pruner; 00408 UINT32 ClassMask; 00409 UINT32 ClassCount; 00410 CLASS_INDEX ClassIndex; 00411 UINT32 WordIndex; 00412 int Level; 00413 FLOAT32 EndPad, SidePad, AnglePad; 00414 TABLE_FILLER TableFiller; 00415 FILL_SPEC FillSpec; 00416 00417 ClassIndex = IndexForClassId (Templates, ClassId); 00418 Pruner = CPrunerFor (Templates, ClassIndex); 00419 WordIndex = CPrunerWordIndexFor (ClassIndex); 00420 ClassMask = CPrunerMaskFor (MAX_LEVEL, ClassIndex); 00421 00422 for (Level = NumCPLevels - 1; Level >= 0; Level--) { 00423 GetCPPadsForLevel(Level, &EndPad, &SidePad, &AnglePad); 00424 ClassCount = CPrunerMaskFor (Level, ClassIndex); 00425 InitTableFiller(EndPad, SidePad, AnglePad, Proto, &TableFiller); 00426 00427 while (!FillerDone (&TableFiller)) { 00428 GetNextFill(&TableFiller, &FillSpec); 00429 DoFill(&FillSpec, Pruner, ClassMask, ClassCount, WordIndex); 00430 } 00431 } 00432 } /* AddProtoToClassPruner */
Updates the proto-pruner lookup tables for Class to include a new proto identified by ProtoId and described by Proto.
Proto | Floating-pt proto to be added to proto pruner | |
ProtoId | Id of proto | |
Class | Integer class that contains desired proto pruner |
Definition at line 447 of file intproto.cpp.
References ANGLE_SHIFT, assert(), cprintf(), FillPPCircularBits(), FillPPLinearBits(), GetPicoFeatureLength, IndexForProto, max, NumIntProtosIn, PI, ProtoAngle, ProtoLength, ProtoSetIn, ProtoX, ProtoY, PRUNER_ANGLE, PRUNER_X, PRUNER_Y, SetForProto, X_SHIFT, and Y_SHIFT.
Referenced by CreateIntTemplates(), MakeNewAdaptedClass(), and MakeNewTempProtos().
00447 { 00448 FLOAT32 Angle, X, Y, Length; 00449 FLOAT32 Pad; 00450 int Index; 00451 PROTO_SET ProtoSet; 00452 00453 if (ProtoId >= NumIntProtosIn (Class)) 00454 cprintf ("AddProtoToProtoPruner:assert failed: %d < %d", 00455 ProtoId, NumIntProtosIn (Class)); 00456 assert (ProtoId < NumIntProtosIn (Class)); 00457 00458 Index = IndexForProto (ProtoId); 00459 ProtoSet = ProtoSetIn (Class, SetForProto (ProtoId)); 00460 00461 Angle = ProtoAngle (Proto); 00462 FillPPCircularBits (ProtoSet->ProtoPruner[PRUNER_ANGLE], Index, 00463 Angle + ANGLE_SHIFT, PPAnglePad / 360.0); 00464 00465 Angle *= 2.0 * PI; 00466 Length = ProtoLength (Proto); 00467 00468 X = ProtoX (Proto) + X_SHIFT; 00469 Pad = max (fabs (cos (Angle)) * (Length / 2.0 + 00470 PPEndPad * GetPicoFeatureLength ()), 00471 fabs (sin (Angle)) * (PPSidePad * GetPicoFeatureLength ())); 00472 00473 FillPPLinearBits (ProtoSet->ProtoPruner[PRUNER_X], Index, X, Pad); 00474 00475 Y = ProtoY (Proto) + Y_SHIFT; 00476 Pad = max (fabs (sin (Angle)) * (Length / 2.0 + 00477 PPEndPad * GetPicoFeatureLength ()), 00478 fabs (cos (Angle)) * (PPSidePad * GetPicoFeatureLength ())); 00479 00480 FillPPLinearBits (ProtoSet->ProtoPruner[PRUNER_Y], Index, Y, Pad); 00481 00482 } /* AddProtoToProtoPruner */
Maps a parameter value into a bucket between 0 and NumBuckets-1.
Param | Parameter value to map into a bucket number | |
Offset | Amount to shift param before mapping it | |
NumBuckets | Number of buckets to map param into |
Definition at line 501 of file intproto.cpp.
References MapParam.
Referenced by ComputeIntFeatures(), and InitTableFiller().
00501 { 00502 int Bucket; 00503 00504 Bucket = (int) MapParam (Param, Offset, NumBuckets); 00505 if (Bucket < 0) 00506 Bucket = 0; 00507 else if (Bucket >= NumBuckets) 00508 Bucket = NumBuckets - 1; 00509 return (Bucket); 00510 00511 } /* BucketFor */
Maps a parameter value into a bucket between 0 and NumBuckets-1.
Param | Parameter value to map into a circular bucket | |
Offset | Amount to shift param before mapping it | |
NumBuckets | Number of buckets to map param into |
Definition at line 529 of file intproto.cpp.
References MapParam.
Referenced by ComputeIntFeatures(), and InitTableFiller().
00529 { 00530 int Bucket; 00531 00532 Bucket = (int) MapParam (Param, Offset, NumBuckets); 00533 if (Bucket < 0) 00534 Bucket += NumBuckets; 00535 else if (Bucket >= NumBuckets) 00536 Bucket -= NumBuckets; 00537 return (Bucket); 00538 00539 } /* CircBucketFor */
void ConvertConfig | ( | BIT_VECTOR | Config, | |
int | ConfigId, | |||
INT_CLASS | Class | |||
) |
Update config vectors of all protos in Class.
Config | Config to be added to class | |
ConfigId | Id to be used for new config | |
Class | Class to add new config to |
It is assumed that the length of the Config bit vector is equal to the number of protos in Class.
Definition at line 578 of file intproto.cpp.
References LengthForConfigId, LengthForProtoId, NumIntProtosIn, ProtoForProtoId, SET_BIT, and test_bit.
Referenced by CreateIntTemplates(), MakeNewAdaptedClass(), and MakeNewTemporaryConfig().
00578 { 00579 int ProtoId; 00580 INT_PROTO Proto; 00581 int TotalLength; 00582 00583 for (ProtoId = 0, TotalLength = 0; 00584 ProtoId < NumIntProtosIn (Class); ProtoId++) 00585 if (test_bit (Config, ProtoId)) { 00586 Proto = ProtoForProtoId (Class, ProtoId); 00587 SET_BIT (Proto->Configs, ConfigId); 00588 TotalLength += LengthForProtoId (Class, ProtoId); 00589 } 00590 LengthForConfigId (Class, ConfigId) = TotalLength; 00591 } /* ConvertConfig */
Converts Proto to integer format and installs it as ProtoId in Class.
Proto | Floating-pt proto to be converted to integer format | |
ProtoId | Id of proto | |
Class | Integer class to add converted proto to |
Definition at line 605 of file intproto.cpp.
References assert(), CoefficientA, CoefficientB, CoefficientC, cprintf(), GetPicoFeatureLength, LearningDebugLevel, LengthForProtoId, NULL, NumIntProtosIn, ProtoAngle, ProtoForProtoId, ProtoLength, and TruncateParam().
Referenced by CreateIntTemplates(), MakeNewAdaptedClass(), and MakeNewTempProtos().
00605 { 00606 INT_PROTO P; 00607 FLOAT32 Param; 00608 00609 assert (ProtoId < NumIntProtosIn (Class)); 00610 00611 P = ProtoForProtoId (Class, ProtoId); 00612 00613 Param = CoefficientA (Proto) * 128; 00614 P->A = TruncateParam (Param, -128, 127, NULL); 00615 00616 Param = -CoefficientB (Proto) * 256; 00617 P->B = TruncateParam (Param, 0, 255, NULL); 00618 00619 Param = CoefficientC (Proto) * 128; 00620 P->C = TruncateParam (Param, -128, 127, NULL); 00621 00622 Param = ProtoAngle (Proto) * 256; 00623 if (Param < 0 || Param >= 256) 00624 P->Angle = 0; 00625 else 00626 P->Angle = (UINT8) Param; 00627 00628 /* round proto length to nearest integer number of pico-features */ 00629 Param = (ProtoLength (Proto) / GetPicoFeatureLength ()) + 0.5; 00630 LengthForProtoId (Class, ProtoId) = TruncateParam (Param, 1, 255, NULL); 00631 if (LearningDebugLevel >= 2) 00632 cprintf ("Converted ffeat to (A=%d,B=%d,C=%d,L=%d)", 00633 P->A, P->B, P->C, LengthForProtoId (Class, ProtoId)); 00634 } /* ConvertProto */
INT_TEMPLATES CreateIntTemplates | ( | CLASSES | FloatProtos | ) |
Converts from the old floating point format to the new integer format.
FloatProtos | Prototypes in old floating pt format |
Definition at line 646 of file intproto.cpp.
References AddIntClass(), AddIntConfig(), AddIntProto(), AddProtoToClassPruner(), AddProtoToProtoPruner(), assert(), ConfigIn, ConvertConfig(), ConvertProto(), NewIntClass(), NewIntTemplates(), NUMBER_OF_CLASSES, NumConfigsIn, NumProtosIn, ProtoIn, and UnusedClassIdIn.
00646 { 00647 INT_TEMPLATES IntTemplates; 00648 CLASS_TYPE FClass; 00649 INT_CLASS IClass; 00650 int ClassId; 00651 int ProtoId; 00652 int ConfigId; 00653 00654 IntTemplates = NewIntTemplates (); 00655 00656 for (ClassId = 0; ClassId < NUMBER_OF_CLASSES; ClassId++) { 00657 FClass = &(FloatProtos[ClassId]); 00658 if (NumProtosIn (FClass) > 0) { 00659 assert (UnusedClassIdIn (IntTemplates, ClassId)); 00660 00661 IClass = NewIntClass (NumProtosIn (FClass), NumConfigsIn (FClass)); 00662 AddIntClass(IntTemplates, ClassId, IClass); 00663 00664 for (ProtoId = 0; ProtoId < NumProtosIn (FClass); ProtoId++) { 00665 AddIntProto(IClass); 00666 ConvertProto (ProtoIn (FClass, ProtoId), ProtoId, IClass); 00667 AddProtoToProtoPruner (ProtoIn (FClass, ProtoId), ProtoId, 00668 IClass); 00669 AddProtoToClassPruner (ProtoIn (FClass, ProtoId), ClassId, 00670 IntTemplates); 00671 } 00672 00673 for (ConfigId = 0; ConfigId < NumConfigsIn (FClass); ConfigId++) { 00674 AddIntConfig(IClass); 00675 ConvertConfig (ConfigIn (FClass, ConfigId), ConfigId, IClass); 00676 } 00677 } 00678 } 00679 return (IntTemplates); 00680 } /* CreateIntTemplates */
void DisplayIntFeature | ( | INT_FEATURE | Feature, | |
FLOAT32 | Evidence | |||
) |
Renders the specified feature into a global display list.
Feature | Pico-feature to be displayed | |
Evidence | Best evidence for this feature (0-1) |
Definition at line 695 of file intproto.cpp.
References GetMatchColorFor(), IntMatchWindow, and RenderIntFeature().
Referenced by IMDisplayFeatureDebugInfo().
00695 { 00696 C_COL Color; 00697 00698 Color = GetMatchColorFor (Evidence); 00699 RenderIntFeature(IntMatchWindow, Feature, Color); 00700 } /* DisplayIntFeature */
Renders the specified proto into a global display list.
Class | Class to take proto from | |
ProtoId | Id of proto in Class to be displayed | |
Evidence | Total evidence for proto (0-1) |
Definition at line 715 of file intproto.cpp.
References GetMatchColorFor(), IntMatchWindow, and RenderIntProto().
Referenced by IMDisplayProtoDebugInfo().
00715 { 00716 C_COL Color; 00717 00718 Color = GetMatchColorFor (Evidence); 00719 RenderIntProto(IntMatchWindow, Class, ProtoId, Color); 00720 00721 } /* DisplayIntProto */
void free_int_class | ( | INT_CLASS | int_class | ) |
Frees a class.
Definition at line 802 of file intproto.cpp.
References Efree(), NumProtoSetsIn, and ProtoSetIn.
Referenced by free_int_templates().
00803 { /*class to free */ 00804 int i; 00805 00806 for (i = 0; i < NumProtoSetsIn (int_class); i++) { 00807 Efree (ProtoSetIn (int_class, i)); 00808 } 00809 Efree (int_class->ProtoLengths); 00810 Efree(int_class); 00811 }
void free_int_templates | ( | INT_TEMPLATES | templates | ) |
Frees the template.
Definition at line 846 of file intproto.cpp.
References ClassForIndex, Efree(), free_int_class(), NumClassesIn, and NumClassPrunersIn.
Referenced by EndAdaptiveClassifier(), and free_adapted_templates().
00846 { 00847 int i; 00848 00849 for (i = 0; i < NumClassesIn (templates); i++) 00850 free_int_class (ClassForIndex (templates, i)); 00851 for (i = 0; i < NumClassPrunersIn (templates); i++) 00852 Efree (templates->ClassPruner[i]); 00853 Efree(templates); 00854 }
CLASS_ID GetClassToDebug | ( | const char * | Prompt | ) |
void InitIntProtoVars | ( | ) |
Initialize the control variables for the integer proto routines.
none |
Definition at line 733 of file intproto.cpp.
Referenced by init_dj_debug().
00733 { 00734 MakeNumCPLevels(); 00735 MakeCPAnglePadLoose(); 00736 MakeCPAnglePadMedium(); 00737 MakeCPAnglePadTight(); 00738 MakeCPEndPadLoose(); 00739 MakeCPEndPadMedium(); 00740 MakeCPEndPadTight(); 00741 MakeCPSidePadLoose(); 00742 MakeCPSidePadMedium(); 00743 MakeCPSidePadTight(); 00744 MakePPAnglePad(); 00745 MakePPEndPad(); 00746 MakePPSidePad(); 00747 } /* InitIntProtoVars */
INT_CLASS NewIntClass | ( | int | MaxNumProtos, | |
int | MaxNumConfigs | |||
) |
Creates a new integer class data structure and returns it.
MaxNumProtos | Number of protos to allocate space for | |
MaxNumConfigs | Number of configs to allocate space for |
Definition at line 763 of file intproto.cpp.
References assert(), Emalloc(), MAX_NUM_CONFIGS, MAX_NUM_PROTO_SETS, MaxNumIntProtosIn, NumIntConfigsIn, NumIntProtosIn, NumProtoSetsIn, ProtoPrunerFor, PROTOS_PER_PROTO_SET, ProtoSetIn, and WERDS_PER_PP.
Referenced by AddAdaptedClass(), and CreateIntTemplates().
00763 { 00764 INT_CLASS Class; 00765 PROTO_SET ProtoSet; 00766 int i; 00767 register UINT32 *Word; 00768 00769 assert (MaxNumConfigs <= MAX_NUM_CONFIGS); 00770 00771 Class = (INT_CLASS) Emalloc (sizeof (INT_CLASS_STRUCT)); 00772 NumProtoSetsIn (Class) = ((MaxNumProtos + PROTOS_PER_PROTO_SET - 1) / 00773 PROTOS_PER_PROTO_SET); 00774 00775 assert (NumProtoSetsIn (Class) <= MAX_NUM_PROTO_SETS); 00776 00777 NumIntProtosIn (Class) = 0; 00778 NumIntConfigsIn (Class) = 0; 00779 00780 for (i = 0; i < NumProtoSetsIn (Class); i++) { 00781 /* allocate space for a proto set, install in class, and initialize */ 00782 ProtoSet = (PROTO_SET) Emalloc (sizeof (PROTO_SET_STRUCT)); 00783 ProtoSetIn (Class, i) = ProtoSet; 00784 for (Word = (UINT32 *) (ProtoPrunerFor (ProtoSet)); 00785 Word < (UINT32 *) (ProtoPrunerFor (ProtoSet)) + WERDS_PER_PP; 00786 *Word++ = 0); 00787 00788 /* allocate space for the proto lengths and install in class */ 00789 } 00790 Class->ProtoLengths = (UINT8 *) Emalloc (MaxNumIntProtosIn (Class) * 00791 sizeof (UINT8)); 00792 00793 return (Class); 00794 00795 } /* NewIntClass */
INT_TEMPLATES NewIntTemplates | ( | ) |
Allocates a new set of integer templates initialized to hold 0 classes.
none |
Definition at line 823 of file intproto.cpp.
References ClassIdForIndex, Emalloc(), ILLEGAL_CLASS, IndexForClassId, MAX_CLASS_ID, MAX_NUM_CLASSES, NO_CLASS, NumClassesIn, and NumClassPrunersIn.
Referenced by CreateIntTemplates(), NewAdaptedTemplates(), and ReadIntTemplates().
00823 { 00824 INT_TEMPLATES T; 00825 int i; 00826 00827 T = (INT_TEMPLATES) Emalloc (sizeof (INT_TEMPLATES_STRUCT)); 00828 NumClassesIn (T) = 0; 00829 NumClassPrunersIn (T) = 0; 00830 00831 /* initialize mapping tables */ 00832 for (i = 0; i <= MAX_CLASS_ID; i++) 00833 IndexForClassId (T, i) = ILLEGAL_CLASS; 00834 for (i = 0; i < MAX_NUM_CLASSES; i++) 00835 ClassIdForIndex (T, i) = NO_CLASS; 00836 00837 return (T); 00838 00839 } /* NewIntTemplates */
INT_TEMPLATES ReadIntTemplates | ( | FILE * | File, | |
BOOL8 | swap | |||
) |
Reads a set of integer templates from File.
File | Open file to read templates from | |
swap | 0 or 1, if need to call reverse32 |
Definition at line 870 of file intproto.cpp.
References ClassForIndex, cprintf(), Emalloc(), MAX_CLASS_ID, MAX_NUM_CLASS_PRUNERS, MAX_NUM_CLASSES, MAX_NUM_CONFIGS, MAX_NUM_PROTO_SETS, MaxNumIntProtosIn, NewIntTemplates(), NUM_CP_BUCKETS, NUM_PP_BUCKETS, NUM_PP_PARAMS, NumClassesIn, NumClassPrunersIn, NumProtoSetsIn, PROTOS_PER_PROTO_SET, ProtoSetIn, reverse16(), reverse32(), WERDS_PER_CONFIG_VEC, WERDS_PER_CP_VECTOR, and WERDS_PER_PP_VECTOR.
Referenced by InitAdaptiveClassifier(), and ReadAdaptedTemplates().
00870 { 00871 int i, j, x, y, z; 00872 int nread; 00873 INT_TEMPLATES Templates; 00874 CLASS_PRUNER Pruner; 00875 INT_CLASS Class; 00876 UINT8 *Lengths; 00877 PROTO_SET ProtoSet; 00878 00879 /* first read the high level template struct */ 00880 Templates = NewIntTemplates (); 00881 // Read Templates in parts for 64 bit compatibility. 00882 if (fread(&Templates->NumClasses, sizeof(int), 1, File) != 1 || 00883 fread(&Templates->NumClassPruners, sizeof(int), 1, File) != 1) 00884 cprintf ("Bad read of inttemp!\n"); 00885 for (i = 0; i <= MAX_CLASS_ID; ++i) { 00886 if (fread(&Templates->IndexFor[i], sizeof(CLASS_INDEX), 1, File) != 1) 00887 cprintf("Bad read of inttemp!\n"); 00888 } 00889 for (i = 0; i < MAX_NUM_CLASSES; ++i) { 00890 if (fread(&Templates->ClassIdFor[i], sizeof(CLASS_ID), 1, File) != 1) 00891 cprintf("Bad read of inttemp!\n"); 00892 } 00893 for (i = 0; i < MAX_NUM_CLASSES + MAX_NUM_CLASS_PRUNERS; ++i) { 00894 int junk; 00895 if (fread(&junk, sizeof(junk), 1, File) != 1) 00896 cprintf("Bad read of inttemp!\n"); 00897 } 00898 // Swap status is determined automatically. 00899 swap = Templates->NumClassPruners < 0 || 00900 Templates->NumClassPruners > MAX_NUM_CLASS_PRUNERS; 00901 if (swap) { 00902 reverse32 (&Templates->NumClassPruners); 00903 reverse32 (&Templates->NumClasses); 00904 for (i = 0; i < MAX_CLASS_ID + 1; i++) 00905 reverse16 (&Templates->IndexFor[i]); 00906 } 00907 00908 /* then read in the class pruners */ 00909 for (i = 0; i < NumClassPrunersIn (Templates); i++) { 00910 Pruner = (CLASS_PRUNER) Emalloc (sizeof (CLASS_PRUNER_STRUCT)); 00911 if ((nread = 00912 fread ((char *) Pruner, 1, sizeof (CLASS_PRUNER_STRUCT), 00913 File)) != sizeof (CLASS_PRUNER_STRUCT)) 00914 cprintf ("Bad read of inttemp!\n"); 00915 if (swap) { 00916 for (j = 0; j < NUM_CP_BUCKETS; j++) { 00917 for (x = 0; x < NUM_CP_BUCKETS; x++) { 00918 for (y = 0; y < NUM_CP_BUCKETS; y++) { 00919 for (z = 0; z < WERDS_PER_CP_VECTOR; z++) { 00920 reverse32 (&Pruner[j][x][y][z]); 00921 } 00922 } 00923 } 00924 } 00925 } 00926 Templates->ClassPruner[i] = Pruner; 00927 } 00928 00929 /* then read in each class */ 00930 for (i = 0; i < NumClassesIn (Templates); i++) { 00931 /* first read in the high level struct for the class */ 00932 Class = (INT_CLASS) Emalloc (sizeof (INT_CLASS_STRUCT)); 00933 if (fread(&Class->NumProtos, sizeof(Class->NumProtos), 1, File) != 1 || 00934 fread(&Class->NumProtoSets, sizeof(Class->NumProtoSets), 1, File) != 1 || 00935 fread(&Class->NumConfigs, sizeof(Class->NumConfigs), 1, File) != 1) 00936 cprintf ("Bad read of inttemp!\n"); 00937 for (j = 0; j <= MAX_NUM_PROTO_SETS; ++j) { 00938 int junk; 00939 if (fread(&junk, sizeof(junk), 1, File) != 1) 00940 cprintf ("Bad read of inttemp!\n"); 00941 } 00942 for (j = 0; j < MAX_NUM_CONFIGS; ++j) { 00943 if (fread(&Class->ConfigLengths[j], sizeof(UINT16), 1, File) != 1) 00944 cprintf ("Bad read of inttemp!\n"); 00945 } 00946 if (swap) { 00947 reverse16 (&Class->NumProtos); 00948 for (j = 0; j < MAX_NUM_CONFIGS; j++) 00949 reverse16 (&Class->ConfigLengths[j]); 00950 } 00951 ClassForIndex (Templates, i) = Class; 00952 00953 /* then read in the proto lengths */ 00954 Lengths = (UINT8 *) Emalloc (sizeof (UINT8) * 00955 MaxNumIntProtosIn (Class)); 00956 if ((nread = fread ((char *) Lengths, sizeof (UINT8), 00957 MaxNumIntProtosIn (Class), 00958 File)) != MaxNumIntProtosIn (Class)) 00959 cprintf ("Bad read of inttemp!\n"); 00960 Class->ProtoLengths = Lengths; 00961 00962 /* then read in the proto sets */ 00963 for (j = 0; j < NumProtoSetsIn (Class); j++) { 00964 ProtoSet = (PROTO_SET) Emalloc (sizeof (PROTO_SET_STRUCT)); 00965 if ((nread = 00966 fread ((char *) ProtoSet, 1, sizeof (PROTO_SET_STRUCT), 00967 File)) != sizeof (PROTO_SET_STRUCT)) 00968 cprintf ("Bad read of inttemp!\n"); 00969 if (swap) { 00970 for (x = 0; x < NUM_PP_PARAMS; x++) 00971 for (y = 0; y < NUM_PP_BUCKETS; y++) 00972 for (z = 0; z < WERDS_PER_PP_VECTOR; z++) 00973 reverse32 (&ProtoSet->ProtoPruner[x][y][z]); 00974 for (x = 0; x < PROTOS_PER_PROTO_SET; x++) 00975 for (y = 0; y < WERDS_PER_CONFIG_VEC; y++) 00976 reverse32 (&ProtoSet->Protos[x].Configs[y]); 00977 } 00978 ProtoSetIn (Class, j) = ProtoSet; 00979 } 00980 } 00981 return (Templates); 00982 } /* ReadIntTemplates */
void ShowMatchDisplay | ( | ) |
Sends the shapes in the global display lists to the match debugger window.
none |
Definition at line 999 of file intproto.cpp.
References baseline, c_clear_window(), c_create_window(), c_draw(), c_line_color_index(), c_move(), Grey, INT_BASELINE, INT_CAPHEIGHT, INT_DESCENDER, INT_MAX_X, INT_MAX_Y, INT_MIN_X, INT_MIN_Y, INT_XCENTER, INT_XHEIGHT, INT_XRADIUS, INT_YCENTER, INT_YRADIUS, IntMatchWindow, NormMethod, and NULL.
Referenced by AdaptToChar(), and DebugAdaptiveClassifier().
00999 { 01000 void *window; 01001 /* Size of drawable */ 01002 if (IntMatchWindow == NULL) { 01003 IntMatchWindow = c_create_window ("IntMatchWindow", 50, 200, 01004 520, 520, 01005 -130.0, 130.0, -130.0, 130.0); 01006 } 01007 else 01008 c_clear_window(IntMatchWindow); 01009 01010 window = IntMatchWindow; 01011 c_line_color_index(window, Grey); 01012 /* Default size of drawing */ 01013 if (NormMethod == baseline) { 01014 c_move (window, -1000.0, INT_BASELINE); 01015 c_draw (window, 1000.0, INT_BASELINE); 01016 c_move (window, -1000.0, INT_DESCENDER); 01017 c_draw (window, 1000.0, INT_DESCENDER); 01018 c_move (window, -1000.0, INT_XHEIGHT); 01019 c_draw (window, 1000.0, INT_XHEIGHT); 01020 c_move (window, -1000.0, INT_CAPHEIGHT); 01021 c_draw (window, 1000.0, INT_CAPHEIGHT); 01022 c_move (window, INT_MIN_X, -1000.0); 01023 c_draw (window, INT_MIN_X, 1000.0); 01024 c_move (window, INT_MAX_X, -1000.0); 01025 c_draw (window, INT_MAX_X, 1000.0); 01026 } 01027 else { 01028 c_move (window, INT_XCENTER - INT_XRADIUS, INT_YCENTER - INT_YRADIUS); 01029 c_draw (window, INT_XCENTER + INT_XRADIUS, INT_YCENTER - INT_YRADIUS); 01030 c_move (window, INT_XCENTER - INT_XRADIUS, INT_YCENTER + INT_YRADIUS); 01031 c_draw (window, INT_XCENTER + INT_XRADIUS, INT_YCENTER + INT_YRADIUS); 01032 c_move (window, INT_XCENTER - INT_XRADIUS, INT_YCENTER - INT_YRADIUS); 01033 c_draw (window, INT_XCENTER - INT_XRADIUS, INT_YCENTER + INT_YRADIUS); 01034 c_move (window, INT_XCENTER + INT_XRADIUS, INT_YCENTER - INT_YRADIUS); 01035 c_draw (window, INT_XCENTER + INT_XRADIUS, INT_YCENTER + INT_YRADIUS); 01036 c_move(window, INT_MIN_X, INT_MIN_Y); 01037 c_draw(window, INT_MIN_X, INT_MAX_Y); 01038 c_move(window, INT_MIN_X, INT_MIN_Y); 01039 c_draw(window, INT_MAX_X, INT_MIN_Y); 01040 c_move(window, INT_MAX_X, INT_MAX_Y); 01041 c_draw(window, INT_MIN_X, INT_MAX_Y); 01042 c_move(window, INT_MAX_X, INT_MAX_Y); 01043 c_draw(window, INT_MAX_X, INT_MIN_Y); 01044 } 01045 } /* ShowMatchDisplay */
void UpdateMatchDisplay | ( | ) |
Clears the global feature and proto display lists.
none |
Definition at line 555 of file intproto.cpp.
References c_make_current(), IntMatchWindow, and NULL.
Referenced by AdaptToChar(), and DebugAdaptiveClassifier().
00555 { 00556 if (IntMatchWindow != NULL) 00557 c_make_current(IntMatchWindow); 00558 } /* ClearMatchDisplay */
void WriteIntTemplates | ( | FILE * | File, | |
INT_TEMPLATES | Templates | |||
) |
Writes Templates to File.
File | Open file to write templates to | |
Templates | Templates to save into File |
Definition at line 1061 of file intproto.cpp.
References ClassForIndex, MaxNumIntProtosIn, NumClassesIn, NumClassPrunersIn, NumProtoSetsIn, and ProtoSetIn.
Referenced by WriteAdaptedTemplates().
01061 { 01062 int i, j; 01063 INT_CLASS Class; 01064 01065 /* first write the high level template struct */ 01066 fwrite ((char *) Templates, sizeof (INT_TEMPLATES_STRUCT), 1, File); 01067 01068 /* then write out the class pruners */ 01069 for (i = 0; i < NumClassPrunersIn (Templates); i++) 01070 fwrite ((char *) (Templates->ClassPruner[i]), 01071 sizeof (CLASS_PRUNER_STRUCT), 1, File); 01072 01073 /* then write out each class */ 01074 for (i = 0; i < NumClassesIn (Templates); i++) { 01075 Class = ClassForIndex (Templates, i); 01076 01077 /* first write out the high level struct for the class */ 01078 fwrite ((char *) Class, sizeof (INT_CLASS_STRUCT), 1, File); 01079 01080 /* then write out the proto lengths */ 01081 fwrite ((char *) (Class->ProtoLengths), sizeof (UINT8), 01082 MaxNumIntProtosIn (Class), File); 01083 01084 /* then write out the proto sets */ 01085 for (j = 0; j < NumProtoSetsIn (Class); j++) 01086 fwrite ((char *) ProtoSetIn (Class, j), 01087 sizeof (PROTO_SET_STRUCT), 1, File); 01088 } 01089 } /* WriteIntTemplates */