tesseract  4.0.0-beta.1-59-g2cc4
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_t NumFeatures, int32_t used_features)
 
void UpdateSumOfProtoEvidences (INT_CLASS ClassTemplate, BIT_VECTOR ConfigMask, int16_t NumFeatures)
 

Public Attributes

uint8_t feature_evidence_ [MAX_NUM_CONFIGS]
 
int sum_feature_evidence_ [MAX_NUM_CONFIGS]
 
uint8_t 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 708 of file intmatcher.cpp.

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

◆ ClearFeatureEvidence()

void ScratchEvidence::ClearFeatureEvidence ( const INT_CLASS  class_template)

Definition at line 715 of file intmatcher.cpp.

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

◆ NormalizeSums()

void ScratchEvidence::NormalizeSums ( INT_CLASS  ClassTemplate,
int16_t  NumFeatures,
int32_t  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 1168 of file intmatcher.cpp.

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

◆ UpdateSumOfProtoEvidences()

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

Add sum of Proto Evidences into Sum Of Feature Evidence Array

Definition at line 1127 of file intmatcher.cpp.

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

Member Data Documentation

◆ feature_evidence_

uint8_t ScratchEvidence::feature_evidence_[MAX_NUM_CONFIGS]

Definition at line 70 of file intmatcher.h.

◆ proto_evidence_

uint8_t 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: