Extract the OCR results, costs (penalty points for uncertainty), and the bounding boxes of the characters.
2674 TESS_CHAR_LIST tess_chars;
2675 TESS_CHAR_IT tess_chars_it(&tess_chars);
2676 extract_result(&tess_chars_it, page_res);
2677 tess_chars_it.move_to_first();
2678 int n = tess_chars.length();
2680 *lengths =
new int[n];
2681 *costs =
new float[n];
2687 for (tess_chars_it.mark_cycle_pt();
2688 !tess_chars_it.cycled_list();
2689 tess_chars_it.forward(), i++) {
2690 TESS_CHAR *tc = tess_chars_it.data();
2691 text_len += (*lengths)[i] = tc->length;
2692 (*costs)[i] = tc->cost;
2693 (*x0)[i] = tc->box.left();
2694 (*y0)[i] = tc->box.bottom();
2695 (*x1)[i] = tc->box.right();
2696 (*y1)[i] = tc->box.top();
2698 char *p = *text =
new char[text_len];
2700 tess_chars_it.move_to_first();
2701 for (tess_chars_it.mark_cycle_pt();
2702 !tess_chars_it.cycled_list();
2703 tess_chars_it.forward()) {
2704 TESS_CHAR *tc = tess_chars_it.data();
2705 strncpy(p, tc->unicode_repr, tc->length);