Extract the OCR results, costs (penalty points for uncertainty), and the bounding boxes of the characters.
2701 TESS_CHAR_LIST tess_chars;
2702 TESS_CHAR_IT tess_chars_it(&tess_chars);
2703 extract_result(&tess_chars_it, page_res);
2704 tess_chars_it.move_to_first();
2705 int n = tess_chars.length();
2707 *lengths =
new int[n];
2708 *costs =
new float[n];
2714 for (tess_chars_it.mark_cycle_pt();
2715 !tess_chars_it.cycled_list();
2716 tess_chars_it.forward(), i++) {
2717 TESS_CHAR *tc = tess_chars_it.data();
2718 text_len += (*lengths)[i] = tc->length;
2719 (*costs)[i] = tc->cost;
2720 (*x0)[i] = tc->box.left();
2721 (*y0)[i] = tc->box.bottom();
2722 (*x1)[i] = tc->box.right();
2723 (*y1)[i] = tc->box.top();
2725 char *p = *text =
new char[text_len];
2727 tess_chars_it.move_to_first();
2728 for (tess_chars_it.mark_cycle_pt();
2729 !tess_chars_it.cycled_list();
2730 tess_chars_it.forward()) {
2731 TESS_CHAR *tc = tess_chars_it.data();
2732 strncpy(p, tc->unicode_repr, tc->length);