mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-03 00:49:01 +08:00
normmatch: Remove unused private function
PrintNormMatch was unused. Remove it and remove also an unused prototype. Make the only remaining private function NormEvidenceOf static. Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
b9b74a6942
commit
caa04882fd
@ -2,7 +2,6 @@
|
|||||||
** Filename: normmatch.c
|
** Filename: normmatch.c
|
||||||
** Purpose: Simple matcher based on character normalization features.
|
** Purpose: Simple matcher based on character normalization features.
|
||||||
** Author: Dan Johnson
|
** Author: Dan Johnson
|
||||||
** History: Wed Dec 19 16:18:06 1990, DSJ, Created.
|
|
||||||
**
|
**
|
||||||
** (c) Copyright Hewlett-Packard Company, 1988.
|
** (c) Copyright Hewlett-Packard Company, 1988.
|
||||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -40,16 +39,28 @@ struct NORM_PROTOS
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
Private Function Prototypes
|
Private Code
|
||||||
----------------------------------------------------------------------------*/
|
----------------------------------------------------------------------------*/
|
||||||
double NormEvidenceOf(double NormAdj);
|
|
||||||
|
|
||||||
void PrintNormMatch(FILE *File,
|
/**
|
||||||
int NumParams,
|
* @name NormEvidenceOf
|
||||||
PROTOTYPE *Proto,
|
*
|
||||||
FEATURE Feature);
|
* Return the new type of evidence number corresponding to this
|
||||||
|
* normalization adjustment. The equation that represents the transform is:
|
||||||
|
* 1 / (1 + (NormAdj / midpoint) ^ curl)
|
||||||
|
*/
|
||||||
|
static double NormEvidenceOf(double NormAdj) {
|
||||||
|
NormAdj /= classify_norm_adj_midpoint;
|
||||||
|
|
||||||
NORM_PROTOS *ReadNormProtos(FILE *File);
|
if (classify_norm_adj_curl == 3) {
|
||||||
|
NormAdj = NormAdj * NormAdj * NormAdj;
|
||||||
|
} else if (classify_norm_adj_curl == 2) {
|
||||||
|
NormAdj = NormAdj * NormAdj;
|
||||||
|
} else {
|
||||||
|
NormAdj = pow(NormAdj, classify_norm_adj_curl);
|
||||||
|
}
|
||||||
|
return (1.0 / (1.0 + NormAdj));
|
||||||
|
}
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
Variables
|
Variables
|
||||||
@ -165,62 +176,6 @@ void Classify::FreeNormProtos() {
|
|||||||
}
|
}
|
||||||
} // namespace tesseract
|
} // namespace tesseract
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------
|
|
||||||
Private Code
|
|
||||||
----------------------------------------------------------------------------*/
|
|
||||||
/**
|
|
||||||
* @name NormEvidenceOf
|
|
||||||
*
|
|
||||||
* Return the new type of evidence number corresponding to this
|
|
||||||
* normalization adjustment. The equation that represents the transform is:
|
|
||||||
* 1 / (1 + (NormAdj / midpoint) ^ curl)
|
|
||||||
*/
|
|
||||||
double NormEvidenceOf(double NormAdj) {
|
|
||||||
NormAdj /= classify_norm_adj_midpoint;
|
|
||||||
|
|
||||||
if (classify_norm_adj_curl == 3)
|
|
||||||
NormAdj = NormAdj * NormAdj * NormAdj;
|
|
||||||
else if (classify_norm_adj_curl == 2)
|
|
||||||
NormAdj = NormAdj * NormAdj;
|
|
||||||
else
|
|
||||||
NormAdj = pow (NormAdj, classify_norm_adj_curl);
|
|
||||||
return (1.0 / (1.0 + NormAdj));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/**
|
|
||||||
* This routine dumps out detailed normalization match info.
|
|
||||||
* @param File open text file to dump match debug info to
|
|
||||||
* @param NumParams # of parameters in proto and feature
|
|
||||||
* @param Proto[] array of prototype parameters
|
|
||||||
* @param Feature[] array of feature parameters
|
|
||||||
* Globals: none
|
|
||||||
* @return none
|
|
||||||
*/
|
|
||||||
void PrintNormMatch(FILE *File,
|
|
||||||
int NumParams,
|
|
||||||
PROTOTYPE *Proto,
|
|
||||||
FEATURE Feature) {
|
|
||||||
int i;
|
|
||||||
float ParamMatch;
|
|
||||||
float TotalMatch;
|
|
||||||
|
|
||||||
for (i = 0, TotalMatch = 0.0; i < NumParams; i++) {
|
|
||||||
ParamMatch = (Feature->Params[i] - Mean(Proto, i)) /
|
|
||||||
StandardDeviation(Proto, i);
|
|
||||||
|
|
||||||
fprintf (File, " %6.1f", ParamMatch);
|
|
||||||
|
|
||||||
if (i == CharNormY || i == CharNormRx)
|
|
||||||
TotalMatch += ParamMatch * ParamMatch;
|
|
||||||
}
|
|
||||||
fprintf (File, " --> %6.1f (%4.2f)\n",
|
|
||||||
TotalMatch, NormEvidenceOf (TotalMatch));
|
|
||||||
|
|
||||||
} /* PrintNormMatch */
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
namespace tesseract {
|
namespace tesseract {
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user