tesseract v5.3.3.20231005
tesseract::ScratchEvidence Struct Reference

#include <intmatcher.h>

Public Member Functions

void Clear (const INT_CLASS_STRUCT *class_template)
 
void ClearFeatureEvidence (const INT_CLASS_STRUCT *class_template)
 
void NormalizeSums (INT_CLASS_STRUCT *ClassTemplate, int16_t NumFeatures)
 
void UpdateSumOfProtoEvidences (INT_CLASS_STRUCT *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 49 of file intmatcher.h.

Member Function Documentation

◆ Clear()

void tesseract::ScratchEvidence::Clear ( const INT_CLASS_STRUCT class_template)

Definition at line 697 of file intmatcher.cpp.

697 {
698 memset(sum_feature_evidence_, 0, class_template->NumConfigs * sizeof(sum_feature_evidence_[0]));
699 memset(proto_evidence_, 0, class_template->NumProtos * sizeof(proto_evidence_[0]));
700}
uint8_t proto_evidence_[MAX_NUM_PROTOS][MAX_PROTO_INDEX]
Definition: intmatcher.h:52
int sum_feature_evidence_[MAX_NUM_CONFIGS]
Definition: intmatcher.h:51

◆ ClearFeatureEvidence()

void tesseract::ScratchEvidence::ClearFeatureEvidence ( const INT_CLASS_STRUCT class_template)

Definition at line 702 of file intmatcher.cpp.

702 {
703 memset(feature_evidence_, 0, class_template->NumConfigs * sizeof(feature_evidence_[0]));
704}
uint8_t feature_evidence_[MAX_NUM_CONFIGS]
Definition: intmatcher.h:50

◆ NormalizeSums()

void tesseract::ScratchEvidence::NormalizeSums ( INT_CLASS_STRUCT 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 1112 of file intmatcher.cpp.

1112 {
1113 // ClassTemplate->NumConfigs can become larger than MAX_NUM_CONFIGS.
1114 for (int i = 0; i < MAX_NUM_CONFIGS && i < ClassTemplate->NumConfigs; i++) {
1116 (sum_feature_evidence_[i] << 8) / (NumFeatures + ClassTemplate->ConfigLengths[i]);
1117 }
1118}
#define MAX_NUM_CONFIGS
Definition: intproto.h:47

◆ UpdateSumOfProtoEvidences()

void tesseract::ScratchEvidence::UpdateSumOfProtoEvidences ( INT_CLASS_STRUCT ClassTemplate,
BIT_VECTOR  ConfigMask 
)

Add sum of Proto Evidences into Sum Of Feature Evidence Array

Definition at line 1072 of file intmatcher.cpp.

1072 {
1073 int *IntPointer;
1074 uint32_t ConfigWord;
1075 int ProtoSetIndex;
1076 uint16_t ProtoNum;
1077 PROTO_SET_STRUCT *ProtoSet;
1078 int NumProtos;
1079 uint16_t ActualProtoNum;
1080
1081 NumProtos = ClassTemplate->NumProtos;
1082
1083 for (ProtoSetIndex = 0; ProtoSetIndex < ClassTemplate->NumProtoSets; ProtoSetIndex++) {
1084 ProtoSet = ClassTemplate->ProtoSets[ProtoSetIndex];
1085 ActualProtoNum = (ProtoSetIndex * PROTOS_PER_PROTO_SET);
1086 for (ProtoNum = 0; ((ProtoNum < PROTOS_PER_PROTO_SET) && (ActualProtoNum < NumProtos));
1087 ProtoNum++, ActualProtoNum++) {
1088 int temp = 0;
1089 for (uint8_t i = 0; i < MAX_PROTO_INDEX && i < ClassTemplate->ProtoLengths[ActualProtoNum];
1090 i++) {
1091 temp += proto_evidence_[ActualProtoNum][i];
1092 }
1093
1094 ConfigWord = ProtoSet->Protos[ProtoNum].Configs[0];
1095 ConfigWord &= *ConfigMask;
1096 IntPointer = sum_feature_evidence_;
1097 while (ConfigWord) {
1098 if (ConfigWord & 1) {
1099 *IntPointer += temp;
1100 }
1101 IntPointer++;
1102 ConfigWord >>= 1;
1103 }
1104 }
1105 }
1106}
#define MAX_PROTO_INDEX
Definition: intproto.h:44
#define PROTOS_PER_PROTO_SET
Definition: intproto.h:49

Member Data Documentation

◆ feature_evidence_

uint8_t tesseract::ScratchEvidence::feature_evidence_[MAX_NUM_CONFIGS]

Definition at line 50 of file intmatcher.h.

◆ proto_evidence_

uint8_t tesseract::ScratchEvidence::proto_evidence_[MAX_NUM_PROTOS][MAX_PROTO_INDEX]

Definition at line 52 of file intmatcher.h.

◆ sum_feature_evidence_

int tesseract::ScratchEvidence::sum_feature_evidence_[MAX_NUM_CONFIGS]

Definition at line 51 of file intmatcher.h.


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