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

Method MergeSimilarTabVectors

deps/tesseract/textord/tabvector.cpp:361–390  ·  view source on GitHub ↗

Merge close tab vectors of the same side that overlap.

Source from the content-addressed store, hash-verified

359
360// Merge close tab vectors of the same side that overlap.
361void TabVector::MergeSimilarTabVectors(const ICOORD& vertical,
362 TabVector_LIST* vectors,
363 BlobGrid* grid) {
364 TabVector_IT it1(vectors);
365 for (it1.mark_cycle_pt(); !it1.cycled_list(); it1.forward()) {
366 TabVector* v1 = it1.data();
367 TabVector_IT it2(it1);
368 for (it2.forward(); !it2.at_first(); it2.forward()) {
369 TabVector* v2 = it2.data();
370 if (v2->SimilarTo(vertical, *v1, grid)) {
371 // Merge into the forward one, in case the combined vector now
372 // overlaps one in between.
373 if (textord_debug_tabfind) {
374 v2->Print("Merging");
375 v1->Print("by deleting");
376 }
377 v2->MergeWith(vertical, it1.extract());
378 if (textord_debug_tabfind) {
379 v2->Print("Producing");
380 }
381 ICOORD merged_vector = v2->endpt();
382 merged_vector -= v2->startpt();
383 if (textord_debug_tabfind && abs(merged_vector.x()) > 100) {
384 v2->Print("Garbage result of merge?");
385 }
386 break;
387 }
388 }
389 }
390}
391
392// Return true if this vector is the same side, overlaps, and close
393// enough to the other to be merged.

Callers

nothing calls this directly

Calls 11

dataMethod · 0.80
SimilarToMethod · 0.80
MergeWithMethod · 0.80
absFunction · 0.50
mark_cycle_ptMethod · 0.45
cycled_listMethod · 0.45
forwardMethod · 0.45
at_firstMethod · 0.45
PrintMethod · 0.45
extractMethod · 0.45
xMethod · 0.45

Tested by

no test coverage detected