Extract the OCR results, costs (penalty points for uncertainty), and the bounding boxes of the characters.
2885 TESS_CHAR_LIST tess_chars;
2886 TESS_CHAR_IT tess_chars_it(&tess_chars);
2887 extract_result(&tess_chars_it, page_res);
2888 tess_chars_it.move_to_first();
2889 int n = tess_chars.length();
2891 *lengths =
new int[n];
2892 *costs =
new float[n];
2898 for (tess_chars_it.mark_cycle_pt();
2899 !tess_chars_it.cycled_list();
2900 tess_chars_it.forward(), i++) {
2901 TESS_CHAR *tc = tess_chars_it.data();
2902 text_len += (*lengths)[i] = tc->length;
2903 (*costs)[i] = tc->cost;
2904 (*x0)[i] = tc->box.left();
2905 (*y0)[i] = tc->box.bottom();
2906 (*x1)[i] = tc->box.right();
2907 (*y1)[i] = tc->box.top();
2909 char *p = *text =
new char[text_len];
2911 tess_chars_it.move_to_first();
2912 for (tess_chars_it.mark_cycle_pt();
2913 !tess_chars_it.cycled_list();
2914 tess_chars_it.forward()) {
2915 TESS_CHAR *tc = tess_chars_it.data();
2916 strncpy(p, tc->unicode_repr, tc->length);