tesseract 4.1.1
Loading...
Searching...
No Matches
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 58 of file intmatcher.h.

Member Function Documentation

◆ Clear()

void ScratchEvidence::Clear ( const INT_CLASS  class_template)

Definition at line 739 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]));
744}
int sum_feature_evidence_[MAX_NUM_CONFIGS]
Definition: intmatcher.h:60
uint8_t proto_evidence_[MAX_NUM_PROTOS][MAX_PROTO_INDEX]
Definition: intmatcher.h:61
uint16_t NumProtos
Definition: intproto.h:106
uint8_t NumConfigs
Definition: intproto.h:108

◆ ClearFeatureEvidence()

void ScratchEvidence::ClearFeatureEvidence ( const INT_CLASS  class_template)

Definition at line 746 of file intmatcher.cpp.

746 {
747 memset(feature_evidence_, 0,
748 class_template->NumConfigs * sizeof(feature_evidence_[0]));
749}
uint8_t feature_evidence_[MAX_NUM_CONFIGS]
Definition: intmatcher.h:59

◆ 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 1177 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 }
1185}
#define MAX_NUM_CONFIGS
Definition: intproto.h:47
uint16_t ConfigLengths[MAX_NUM_CONFIGS]
Definition: intproto.h:111

◆ UpdateSumOfProtoEvidences()

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

Add sum of Proto Evidences into Sum Of Feature Evidence Array

Definition at line 1134 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 }
1171}
#define MAX_PROTO_INDEX
Definition: intproto.h:44
#define PROTOS_PER_PROTO_SET
Definition: intproto.h:49
uint32_t Configs[WERDS_PER_CONFIG_VEC]
Definition: intproto.h:86
INT_PROTO_STRUCT Protos[PROTOS_PER_PROTO_SET]
Definition: intproto.h:97
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

Member Data Documentation

◆ feature_evidence_

uint8_t ScratchEvidence::feature_evidence_[MAX_NUM_CONFIGS]

Definition at line 59 of file intmatcher.h.

◆ proto_evidence_

uint8_t ScratchEvidence::proto_evidence_[MAX_NUM_PROTOS][MAX_PROTO_INDEX]

Definition at line 61 of file intmatcher.h.

◆ sum_feature_evidence_

int ScratchEvidence::sum_feature_evidence_[MAX_NUM_CONFIGS]

Definition at line 60 of file intmatcher.h.


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