Extract the OCR results, costs (penalty points for uncertainty), and the bounding boxes of the characters.
2499 TESS_CHAR_LIST tess_chars;
2500 TESS_CHAR_IT tess_chars_it(&tess_chars);
2501 extract_result(&tess_chars_it, page_res);
2502 tess_chars_it.move_to_first();
2503 int n = tess_chars.length();
2505 *lengths =
new int[n];
2506 *costs =
new float[n];
2512 for (tess_chars_it.mark_cycle_pt();
2513 !tess_chars_it.cycled_list();
2514 tess_chars_it.forward(), i++) {
2515 TESS_CHAR *tc = tess_chars_it.data();
2516 text_len += (*lengths)[i] = tc->length;
2517 (*costs)[i] = tc->cost;
2518 (*x0)[i] = tc->box.left();
2519 (*y0)[i] = tc->box.bottom();
2520 (*x1)[i] = tc->box.right();
2521 (*y1)[i] = tc->box.top();
2523 char *p = *text =
new char[text_len];
2525 tess_chars_it.move_to_first();
2526 for (tess_chars_it.mark_cycle_pt();
2527 !tess_chars_it.cycled_list();
2528 tess_chars_it.forward()) {
2529 TESS_CHAR *tc = tess_chars_it.data();
2530 strncpy(p, tc->unicode_repr, tc->length);