tesseract  5.0.0-alpha-619-ge9db
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)
 
void UpdateSumOfProtoEvidences (INT_CLASS ClassTemplate, BIT_VECTOR ConfigMask)
 

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 57 of file intmatcher.h.

Member Function Documentation

◆ Clear()

void ScratchEvidence::Clear ( const INT_CLASS  class_template)

Definition at line 738 of file intmatcher.cpp.

739  {
740  memset(sum_feature_evidence_, 0,
741  class_template->NumConfigs * sizeof(sum_feature_evidence_[0]));
742  memset(proto_evidence_, 0,
743  class_template->NumProtos * sizeof(proto_evidence_[0]));

◆ ClearFeatureEvidence()

void ScratchEvidence::ClearFeatureEvidence ( const INT_CLASS  class_template)

Definition at line 745 of file intmatcher.cpp.

746  {
747  memset(feature_evidence_, 0,
748  class_template->NumConfigs * sizeof(feature_evidence_[0]));

◆ NormalizeSums()

void ScratchEvidence::NormalizeSums ( INT_CLASS  ClassTemplate,
int16_t  NumFeatures 
)

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

1178  {
1179 
1180  assert(ClassTemplate->NumConfigs < MAX_NUM_CONFIGS);
1181  for (int i = 0; i < MAX_NUM_CONFIGS && i < ClassTemplate->NumConfigs; i++) {
1183  (NumFeatures + ClassTemplate->ConfigLengths[i]);
1184  }

◆ UpdateSumOfProtoEvidences()

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

Add sum of Proto Evidences into Sum Of Feature Evidence Array

Definition at line 1133 of file intmatcher.cpp.

1135  {
1136 
1137  int *IntPointer;
1138  uint32_t ConfigWord;
1139  int ProtoSetIndex;
1140  uint16_t ProtoNum;
1141  PROTO_SET ProtoSet;
1142  int NumProtos;
1143  uint16_t ActualProtoNum;
1144 
1145  NumProtos = ClassTemplate->NumProtos;
1146 
1147  for (ProtoSetIndex = 0; ProtoSetIndex < ClassTemplate->NumProtoSets;
1148  ProtoSetIndex++) {
1149  ProtoSet = ClassTemplate->ProtoSets[ProtoSetIndex];
1150  ActualProtoNum = (ProtoSetIndex * PROTOS_PER_PROTO_SET);
1151  for (ProtoNum = 0;
1152  ((ProtoNum < PROTOS_PER_PROTO_SET) && (ActualProtoNum < NumProtos));
1153  ProtoNum++, ActualProtoNum++) {
1154  int temp = 0;
1155  assert(ClassTemplate->ProtoLengths[ActualProtoNum] < MAX_PROTO_INDEX);
1156  for (uint8_t i = 0; i < MAX_PROTO_INDEX &&
1157  i < ClassTemplate->ProtoLengths[ActualProtoNum]; i++)
1158  temp += proto_evidence_[ActualProtoNum] [i];
1159 
1160  ConfigWord = ProtoSet->Protos[ProtoNum].Configs[0];
1161  ConfigWord &= *ConfigMask;
1162  IntPointer = sum_feature_evidence_;
1163  while (ConfigWord) {
1164  if (ConfigWord & 1)
1165  *IntPointer += temp;
1166  IntPointer++;
1167  ConfigWord >>= 1;
1168  }
1169  }
1170  }

Member Data Documentation

◆ feature_evidence_

uint8_t ScratchEvidence::feature_evidence_[MAX_NUM_CONFIGS]

Definition at line 58 of file intmatcher.h.

◆ proto_evidence_

uint8_t ScratchEvidence::proto_evidence_[MAX_NUM_PROTOS][MAX_PROTO_INDEX]

Definition at line 60 of file intmatcher.h.

◆ sum_feature_evidence_

int ScratchEvidence::sum_feature_evidence_[MAX_NUM_CONFIGS]

Definition at line 59 of file intmatcher.h.


The documentation for this struct was generated from the following files:
INT_CLASS_STRUCT::ConfigLengths
uint16_t ConfigLengths[MAX_NUM_CONFIGS]
Definition: intproto.h:110
PROTOS_PER_PROTO_SET
#define PROTOS_PER_PROTO_SET
Definition: intproto.h:48
PROTO_SET_STRUCT::Protos
INT_PROTO_STRUCT Protos[PROTOS_PER_PROTO_SET]
Definition: intproto.h:96
INT_PROTO_STRUCT::Configs
uint32_t Configs[WERDS_PER_CONFIG_VEC]
Definition: intproto.h:85
INT_CLASS_STRUCT::NumProtos
uint16_t NumProtos
Definition: intproto.h:105
ScratchEvidence::feature_evidence_
uint8_t feature_evidence_[MAX_NUM_CONFIGS]
Definition: intmatcher.h:58
INT_CLASS_STRUCT::NumProtoSets
uint8_t NumProtoSets
Definition: intproto.h:106
MAX_NUM_CONFIGS
#define MAX_NUM_CONFIGS
Definition: intproto.h:46
INT_CLASS_STRUCT::ProtoLengths
uint8_t * ProtoLengths
Definition: intproto.h:109
MAX_PROTO_INDEX
#define MAX_PROTO_INDEX
Definition: intproto.h:43
ScratchEvidence::sum_feature_evidence_
int sum_feature_evidence_[MAX_NUM_CONFIGS]
Definition: intmatcher.h:59
INT_CLASS_STRUCT::ProtoSets
PROTO_SET ProtoSets[MAX_NUM_PROTO_SETS]
Definition: intproto.h:108
PROTO_SET_STRUCT
Definition: intproto.h:94
INT_CLASS_STRUCT::NumConfigs
uint8_t NumConfigs
Definition: intproto.h:107
ScratchEvidence::proto_evidence_
uint8_t proto_evidence_[MAX_NUM_PROTOS][MAX_PROTO_INDEX]
Definition: intmatcher.h:60