MCPcopy Create free account
hub / github.com/creatale/node-dv / RebuildBestState

Method RebuildBestState

deps/tesseract/ccstruct/pageres.cpp:800–824  ·  view source on GitHub ↗

Builds the rebuild_word and sets the best_state from the chopped_word and the best_choice->state.

Source from the content-addressed store, hash-verified

798// Builds the rebuild_word and sets the best_state from the chopped_word and
799// the best_choice->state.
800void WERD_RES::RebuildBestState() {
801 ASSERT_HOST(best_choice != NULL);
802 if (rebuild_word != NULL)
803 delete rebuild_word;
804 rebuild_word = new TWERD;
805 if (seam_array.empty())
806 start_seam_list(chopped_word, &seam_array);
807 best_state.truncate(0);
808 int start = 0;
809 for (int i = 0; i < best_choice->length(); ++i) {
810 int length = best_choice->state(i);
811 best_state.push_back(length);
812 if (length > 1) {
813 SEAM::JoinPieces(seam_array, chopped_word->blobs, start,
814 start + length - 1);
815 }
816 TBLOB* blob = chopped_word->blobs[start];
817 rebuild_word->blobs.push_back(new TBLOB(*blob));
818 if (length > 1) {
819 SEAM::BreakPieces(seam_array, chopped_word->blobs, start,
820 start + length - 1);
821 }
822 start += length;
823 }
824}
825
826// Copies the chopped_word to the rebuild_word, faking a best_state as well.
827// Also sets up the output box_word.

Callers 2

TidyUpMethod · 0.80
chop_word_mainMethod · 0.80

Calls 5

start_seam_listFunction · 0.85
emptyMethod · 0.45
truncateMethod · 0.45
lengthMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected