Extract the OCR results, costs (penalty points for uncertainty), and the bounding boxes of the characters.
2563 TESS_CHAR_LIST tess_chars;
2564 TESS_CHAR_IT tess_chars_it(&tess_chars);
2565 extract_result(&tess_chars_it, page_res);
2566 tess_chars_it.move_to_first();
2567 int n = tess_chars.length();
2569 *lengths =
new int[n];
2570 *costs =
new float[n];
2576 for (tess_chars_it.mark_cycle_pt();
2577 !tess_chars_it.cycled_list();
2578 tess_chars_it.forward(), i++) {
2579 TESS_CHAR *tc = tess_chars_it.data();
2580 text_len += (*lengths)[i] = tc->length;
2581 (*costs)[i] = tc->cost;
2582 (*x0)[i] = tc->box.left();
2583 (*y0)[i] = tc->box.bottom();
2584 (*x1)[i] = tc->box.right();
2585 (*y1)[i] = tc->box.top();
2587 char *p = *text =
new char[text_len];
2589 tess_chars_it.move_to_first();
2590 for (tess_chars_it.mark_cycle_pt();
2591 !tess_chars_it.cycled_list();
2592 tess_chars_it.forward()) {
2593 TESS_CHAR *tc = tess_chars_it.data();
2594 strncpy(p, tc->unicode_repr, tc->length);