tesseract  4.00.00dev
ScratchEvidence Struct Reference

#include <intmatcher.h>

Public Member Functions

void Clear (const INT_CLASS class_template)
 
void ClearFeatureEvidence (const INT_CLASS class_template)
 
void NormalizeSums (INT_CLASS ClassTemplate, inT16 NumFeatures, inT32 used_features)
 
void UpdateSumOfProtoEvidences (INT_CLASS ClassTemplate, BIT_VECTOR ConfigMask, inT16 NumFeatures)
 

Public Attributes

uinT8 feature_evidence_ [MAX_NUM_CONFIGS]
 
int sum_feature_evidence_ [MAX_NUM_CONFIGS]
 
uinT8 proto_evidence_ [MAX_NUM_PROTOS][MAX_PROTO_INDEX]
 

Detailed Description

Definition at line 69 of file intmatcher.h.

Member Function Documentation

◆ Clear()

void ScratchEvidence::Clear ( const INT_CLASS  class_template)

Definition at line 709 of file intmatcher.cpp.

709  {
710  memset(sum_feature_evidence_, 0,
711  class_template->NumConfigs * sizeof(sum_feature_evidence_[0]));
712  memset(proto_evidence_, 0,
713  class_template->NumProtos * sizeof(proto_evidence_[0]));
714 }
uinT8 NumConfigs
Definition: intproto.h:110
uinT16 NumProtos
Definition: intproto.h:108
int sum_feature_evidence_[MAX_NUM_CONFIGS]
Definition: intmatcher.h:71
uinT8 proto_evidence_[MAX_NUM_PROTOS][MAX_PROTO_INDEX]
Definition: intmatcher.h:72

◆ ClearFeatureEvidence()

void ScratchEvidence::ClearFeatureEvidence ( const INT_CLASS  class_template)

Definition at line 716 of file intmatcher.cpp.

716  {
717  memset(feature_evidence_, 0,
718  class_template->NumConfigs * sizeof(feature_evidence_[0]));
719 }
uinT8 NumConfigs
Definition: intproto.h:110
uinT8 feature_evidence_[MAX_NUM_CONFIGS]
Definition: intmatcher.h:70

◆ NormalizeSums()

void ScratchEvidence::NormalizeSums ( INT_CLASS  ClassTemplate,
inT16  NumFeatures,
inT32  used_features 
)

Normalize Sum of Proto and Feature Evidence by dividing by the sum of the Feature Lengths and the Proto Lengths for each configuration.

Definition at line 1169 of file intmatcher.cpp.

1170  {
1171 
1172  for (int i = 0; i < ClassTemplate->NumConfigs; i++) {
1174  (NumFeatures + ClassTemplate->ConfigLengths[i]);
1175  }
1176 }
uinT8 NumConfigs
Definition: intproto.h:110
int sum_feature_evidence_[MAX_NUM_CONFIGS]
Definition: intmatcher.h:71
uinT16 ConfigLengths[MAX_NUM_CONFIGS]
Definition: intproto.h:113

◆ UpdateSumOfProtoEvidences()

void ScratchEvidence::UpdateSumOfProtoEvidences ( INT_CLASS  ClassTemplate,
BIT_VECTOR  ConfigMask,
inT16  NumFeatures 
)

Add sum of Proto Evidences into Sum Of Feature Evidence Array

Definition at line 1128 of file intmatcher.cpp.

1129  {
1130 
1131  int *IntPointer;
1132  uinT32 ConfigWord;
1133  int ProtoSetIndex;
1134  uinT16 ProtoNum;
1135  PROTO_SET ProtoSet;
1136  int NumProtos;
1137  uinT16 ActualProtoNum;
1138 
1139  NumProtos = ClassTemplate->NumProtos;
1140 
1141  for (ProtoSetIndex = 0; ProtoSetIndex < ClassTemplate->NumProtoSets;
1142  ProtoSetIndex++) {
1143  ProtoSet = ClassTemplate->ProtoSets[ProtoSetIndex];
1144  ActualProtoNum = (ProtoSetIndex * PROTOS_PER_PROTO_SET);
1145  for (ProtoNum = 0;
1146  ((ProtoNum < PROTOS_PER_PROTO_SET) && (ActualProtoNum < NumProtos));
1147  ProtoNum++, ActualProtoNum++) {
1148  int temp = 0;
1149  for (int i = 0; i < ClassTemplate->ProtoLengths[ActualProtoNum]; i++)
1150  temp += proto_evidence_[ActualProtoNum] [i];
1151 
1152  ConfigWord = ProtoSet->Protos[ProtoNum].Configs[0];
1153  ConfigWord &= *ConfigMask;
1154  IntPointer = sum_feature_evidence_;
1155  while (ConfigWord) {
1156  if (ConfigWord & 1)
1157  *IntPointer += temp;
1158  IntPointer++;
1159  ConfigWord >>= 1;
1160  }
1161  }
1162  }
1163 }
PROTO_SET ProtoSets[MAX_NUM_PROTO_SETS]
Definition: intproto.h:111
INT_PROTO_STRUCT Protos[PROTOS_PER_PROTO_SET]
Definition: intproto.h:97
uinT8 NumProtoSets
Definition: intproto.h:109
uinT16 NumProtos
Definition: intproto.h:108
uinT8 * ProtoLengths
Definition: intproto.h:112
uint32_t uinT32
Definition: host.h:39
int sum_feature_evidence_[MAX_NUM_CONFIGS]
Definition: intmatcher.h:71
uinT32 Configs[WERDS_PER_CONFIG_VEC]
Definition: intproto.h:86
#define PROTOS_PER_PROTO_SET
Definition: intproto.h:48
uint16_t uinT16
Definition: host.h:37
uinT8 proto_evidence_[MAX_NUM_PROTOS][MAX_PROTO_INDEX]
Definition: intmatcher.h:72

Member Data Documentation

◆ feature_evidence_

uinT8 ScratchEvidence::feature_evidence_[MAX_NUM_CONFIGS]

Definition at line 70 of file intmatcher.h.

◆ proto_evidence_

uinT8 ScratchEvidence::proto_evidence_[MAX_NUM_PROTOS][MAX_PROTO_INDEX]

Definition at line 72 of file intmatcher.h.

◆ sum_feature_evidence_

int ScratchEvidence::sum_feature_evidence_[MAX_NUM_CONFIGS]

Definition at line 71 of file intmatcher.h.


The documentation for this struct was generated from the following files: