68 for (; blob !=
NULL; blob = blob->
next, ++blob_id) {
74 int min_bottom, max_bottom, min_top, max_top;
84 tprintf(
"Class %s is %s with top %d vs limits of %d->%d, +/-%d\n",
86 bad ?
"Misfit" :
"OK", top, min_top, max_top,
100 for (; blob !=
NULL; blob = blob->
next, ++blob_id) {
108 int min_bottom, max_bottom, min_top, max_top;
118 tprintf(
"Class %s: height=%d, bottom=%d,%d top=%d,%d, actual=%d,%d : ",
120 height, min_bottom, max_bottom, min_top, max_top,
127 min_top > kBlnBaselineOffset &&
133 max_top - kBlnBaselineOffset);
134 int max_xht =
DivRounded(height * kBlnXHeight,
135 min_top - kBlnBaselineOffset);
137 tprintf(
" xht range min=%d, max=%d\n",
142 for (
int y = min_xht; y <= max_xht; ++y)
143 top_stats.
add(y, misfit_dist);
153 float new_xht = top_stats.
median();
155 tprintf(
"Median xht=%f\n", new_xht);
156 tprintf(
"Mode20:A: New x-height = %f (norm), %f (orig)\n",
bool get_isalpha(UNICHAR_ID unichar_id) const
const char *const id_to_unichar(UNICHAR_ID id) const
const int kBlnBaselineOffset
float ComputeCompatibleXheight(WERD_RES *word_res)
int CountMisfitTops(WERD_RES *word_res)
int DivRounded(int a, int b)
bool get_isdigit(UNICHAR_ID unichar_id) const
void get_top_bottom(UNICHAR_ID unichar_id, int *min_bottom, int *max_bottom, int *min_top, int *max_top) const
void add(inT32 value, inT32 count)
int x_ht_acceptance_tolerance
const int kMaxCharTopRange
DLLSYM void tprintf(const char *format,...)
TBOX bounding_box() const
const UNICHAR_ID unichar_id(int index) const
WERD_CHOICE * best_choice