Fixed crash reported as bug 697544 to debian

git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@822 d0cd1f9f-072b-0410-8dd7-cf729c803f20
This commit is contained in:
theraysmith@gmail.com 2013-01-16 00:16:12 +00:00
parent 64c739c8af
commit 00a79cb93a

View File

@ -69,9 +69,15 @@ void Classify::ClearCharNormArray(uinT8* char_norm_array) {
void Classify::ComputeIntCharNormArray(const FEATURE_STRUCT& norm_feature,
uinT8* char_norm_array) {
for (int i = 0; i < unicharset.size(); i++) {
int norm_adjust = static_cast<int>(INT_CHAR_NORM_RANGE *
ComputeNormMatch(i, norm_feature, FALSE));
char_norm_array[i] = ClipToRange(norm_adjust, 0, MAX_INT_CHAR_NORM);
if (i < PreTrainedTemplates->NumClasses) {
int norm_adjust = static_cast<int>(INT_CHAR_NORM_RANGE *
ComputeNormMatch(i, norm_feature, FALSE));
char_norm_array[i] = ClipToRange(norm_adjust, 0, MAX_INT_CHAR_NORM);
} else {
// Classes with no templates (eg. ambigs & ligatures) default
// to worst match.
char_norm_array[i] = MAX_INT_CHAR_NORM;
}
}
} /* ComputeIntCharNormArray */