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

Method InitForSegSearch

deps/tesseract/ccstruct/blamer.cpp:473–499  ·  view source on GitHub ↗

Setup ready to guide the segmentation search to the correct segmentation. The callback pp_cb is used to avoid a cyclic dependency. It calls into LMPainPoints::GenerateForBlamer by pre-binding the WERD_RES, and the LMPainPoints itself. pp_cb must be a permanent callback, and should be deleted by the caller.

Source from the content-addressed store, hash-verified

471// WERD_RES, and the LMPainPoints itself.
472// pp_cb must be a permanent callback, and should be deleted by the caller.
473void BlamerBundle::InitForSegSearch(const WERD_CHOICE *best_choice,
474 MATRIX* ratings, UNICHAR_ID wildcard_id,
475 bool debug, STRING *debug_str,
476 TessResultCallback2<bool, int, int>* cb) {
477 segsearch_is_looking_for_blame_ = true;
478 if (debug) {
479 tprintf("segsearch starting to look for blame\n");
480 }
481 // Fill pain points for any unclassifed blob corresponding to the
482 // correct segmentation state.
483 *debug_str += "Correct segmentation:\n";
484 for (int idx = 0; idx < correct_segmentation_cols_.length(); ++idx) {
485 debug_str->add_str_int("col=", correct_segmentation_cols_[idx]);
486 debug_str->add_str_int(" row=", correct_segmentation_rows_[idx]);
487 *debug_str += "\n";
488 if (!ratings->Classified(correct_segmentation_cols_[idx],
489 correct_segmentation_rows_[idx],
490 wildcard_id) &&
491 !cb->Run(correct_segmentation_cols_[idx],
492 correct_segmentation_rows_[idx])) {
493 segsearch_is_looking_for_blame_ = false;
494 *debug_str += "\nFailed to insert pain point\n";
495 SetBlame(IRR_SEGSEARCH_HEUR, *debug_str, best_choice, debug);
496 break;
497 }
498 } // end for blamer_bundle->correct_segmentation_cols/rows
499}
500// Returns true if the guided segsearch is in progress.
501bool BlamerBundle::GuidedSegsearchStillGoing() const {
502 return segsearch_is_looking_for_blame_;

Callers 1

Calls 4

add_str_intMethod · 0.80
ClassifiedMethod · 0.80
lengthMethod · 0.45
RunMethod · 0.45

Tested by

no test coverage detected