tesseract  4.0.0-1-g2a2b
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 700 of file intmatcher.cpp.

700  {
701  memset(sum_feature_evidence_, 0,
702  class_template->NumConfigs * sizeof(sum_feature_evidence_[0]));
703  memset(proto_evidence_, 0,
704  class_template->NumProtos * sizeof(proto_evidence_[0]));
705 }
uint8_t NumConfigs
Definition: intproto.h:108
uint16_t NumProtos
Definition: intproto.h:106
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

◆ ClearFeatureEvidence()

void ScratchEvidence::ClearFeatureEvidence ( const INT_CLASS  class_template)

Definition at line 707 of file intmatcher.cpp.

707  {
708  memset(feature_evidence_, 0,
709  class_template->NumConfigs * sizeof(feature_evidence_[0]));
710 }
uint8_t NumConfigs
Definition: intproto.h:108
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 1150 of file intmatcher.cpp.

1151  {
1152 
1153  for (int i = 0; i < ClassTemplate->NumConfigs; i++) {
1155  (NumFeatures + ClassTemplate->ConfigLengths[i]);
1156  }
1157 }
uint8_t NumConfigs
Definition: intproto.h:108
uint16_t ConfigLengths[MAX_NUM_CONFIGS]
Definition: intproto.h:111
int sum_feature_evidence_[MAX_NUM_CONFIGS]
Definition: intmatcher.h:71

◆ 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 1109 of file intmatcher.cpp.

1110  {
1111 
1112  int *IntPointer;
1113  uint32_t ConfigWord;
1114  int ProtoSetIndex;
1115  uint16_t ProtoNum;
1116  PROTO_SET ProtoSet;
1117  int NumProtos;
1118  uint16_t ActualProtoNum;
1119 
1120  NumProtos = ClassTemplate->NumProtos;
1121 
1122  for (ProtoSetIndex = 0; ProtoSetIndex < ClassTemplate->NumProtoSets;
1123  ProtoSetIndex++) {
1124  ProtoSet = ClassTemplate->ProtoSets[ProtoSetIndex];
1125  ActualProtoNum = (ProtoSetIndex * PROTOS_PER_PROTO_SET);
1126  for (ProtoNum = 0;
1127  ((ProtoNum < PROTOS_PER_PROTO_SET) && (ActualProtoNum < NumProtos));
1128  ProtoNum++, ActualProtoNum++) {
1129  int temp = 0;
1130  for (int i = 0; i < ClassTemplate->ProtoLengths[ActualProtoNum]; i++)
1131  temp += proto_evidence_[ActualProtoNum] [i];
1132 
1133  ConfigWord = ProtoSet->Protos[ProtoNum].Configs[0];
1134  ConfigWord &= *ConfigMask;
1135  IntPointer = sum_feature_evidence_;
1136  while (ConfigWord) {
1137  if (ConfigWord & 1)
1138  *IntPointer += temp;
1139  IntPointer++;
1140  ConfigWord >>= 1;
1141  }
1142  }
1143  }
1144 }
uint32_t Configs[WERDS_PER_CONFIG_VEC]
Definition: intproto.h:86
uint8_t NumProtoSets
Definition: intproto.h:107
uint8_t * ProtoLengths
Definition: intproto.h:110
PROTO_SET ProtoSets[MAX_NUM_PROTO_SETS]
Definition: intproto.h:109
INT_PROTO_STRUCT Protos[PROTOS_PER_PROTO_SET]
Definition: intproto.h:97
#define PROTOS_PER_PROTO_SET
Definition: intproto.h:49
uint16_t NumProtos
Definition: intproto.h:106
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

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: