35static void horizontal_cblob_projection(
C_BLOB *blob,
37static void horizontal_coutline_projection(
C_OUTLINE *outline,
58 projection.
set_range(blob_box.bottom(), blob_box.top());
66 tprintf(
"Testing underline on blob at (%d,%d)->(%d,%d), base=%d\nOccs:",
70 horizontal_cblob_projection(blob, &projection);
72 for (occ = blob_box.bottom(); occ <
baseline; occ++) {
73 if (occ <= blob_box.top() && projection.
pile_count(occ) > desc_occ) {
80 if (occ >= blob_box.bottom() && occ <= blob_box.top() && projection.
pile_count(occ) > x_occ) {
86 for (occ =
baseline + xheight + 1; occ <= blob_box.top(); occ++) {
87 if (occ >= blob_box.bottom() && projection.
pile_count(occ) > asc_occ) {
92 tprintf(
"%d %d %d\n", desc_occ, x_occ, asc_occ);
94 if (desc_occ == 0 && x_occ == 0 && asc_occ == 0) {
95 tprintf(
"Bottom=%d, top=%d, base=%d, x=%d\n", blob_box.bottom(), blob_box.top(),
baseline,
113static void horizontal_cblob_projection(
118 C_OUTLINE_IT out_it = blob->out_list();
120 for (out_it.mark_cycle_pt(); !out_it.cycled_list(); out_it.forward()) {
121 horizontal_coutline_projection(out_it.data(), stats);
132static void horizontal_coutline_projection(
140 C_OUTLINE_IT out_it = outline->child();
142 pos = outline->start_pos();
143 length = outline->pathlength();
144 for (stepindex = 0; stepindex < length; stepindex++) {
145 step = outline->step(stepindex);
147 stats->add(pos.y(), pos.x());
148 }
else if (step.y() < 0) {
149 stats->add(pos.y() - 1, -pos.x());
154 for (out_it.mark_cycle_pt(); !out_it.cycled_list(); out_it.forward()) {
155 horizontal_coutline_projection(out_it.data(), stats);
#define double_VAR(name, val, comment)
void tprintf(const char *format,...)
bool test_underline(bool testing_on, C_BLOB *blob, int16_t baseline, int16_t xheight)
double textord_underline_threshold
TDimension bottom() const
int32_t pile_count(int32_t value) const
bool set_range(int32_t min_bucket_value, int32_t max_bucket_value)
TBOX bounding_box() const