55static double NormEvidenceOf(
double NormAdj) {
59 NormAdj = NormAdj * NormAdj * NormAdj;
61 NormAdj = NormAdj * NormAdj;
65 return (1.0 / (1.0 + NormAdj));
105 return (1.0f - NormEvidenceOf(Match));
108 float BestMatch = FLT_MAX;
119 float Match = Delta * Delta * Proto->Weight.Elliptical[
CharNormY];
121 tprintf(
"YMiddle: Proto=%g, Delta=%g, Var=%g, Dist=%g\n", Proto->Mean[
CharNormY], Delta,
122 Proto->Weight.Elliptical[
CharNormY], Match);
125 Match += Delta * Delta * Proto->Weight.Elliptical[
CharNormRx];
127 tprintf(
"Height: Proto=%g, Delta=%g, Var=%g, Dist=%g\n", Proto->Mean[
CharNormRx], Delta,
136 Delta = Delta * Delta * Proto->Weight.Elliptical[
CharNormRy];
140 tprintf(
"Total Dist=%g, scaled=%g, sigmoid=%g, penalty=%g\n", Match,
142 256 * (1 - NormEvidenceOf(Match)));
145 if (Match < BestMatch) {
151 return 1.0 - NormEvidenceOf(BestMatch);
187 const int kMaxLineSize = 100;
188 char line[kMaxLineSize];
189 while (fp->
FGets(line, kMaxLineSize) !=
nullptr) {
190 std::istringstream stream(line);
191 stream.imbue(std::locale::classic());
192 stream >> unichar >> NumProtos;
199 for (
int i = 0;
i < NumProtos;
i++) {
204 tprintf(
"Error: unichar %s in normproto file is not in unichar set.\n", unichar);
205 for (
int i = 0;
i < NumProtos;
i++) {
#define double_VAR(name, val, comment)
uint16_t ReadSampleSize(TFile *fp)
double classify_norm_adj_curl
void tprintf(const char *format,...)
const double kWidthErrorWeighting
double classify_norm_adj_midpoint
void FreeProtoList(LIST *ProtoList)
void FreePrototype(void *arg)
LIST push_last(LIST list, void *item)
PROTOTYPE * ReadPrototype(TFile *fp, uint16_t N)
PARAM_DESC * ReadParamDesc(TFile *fp, uint16_t N)
char * FGets(char *buffer, int buffer_size)
const char * id_to_unichar(UNICHAR_ID id) const
bool contains_unichar(const char *const unichar_repr) const
UNICHAR_ID unichar_to_id(const char *const unichar_repr) const
float ComputeNormMatch(CLASS_ID ClassId, const FEATURE_STRUCT &feature, bool DebugMatch)
NORM_PROTOS * ReadNormProtos(TFile *fp)
std::vector< LIST > Protos
std::vector< float > Params