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

Method MergeBlobs

deps/tesseract/ccstruct/blobs.cpp:892–915  ·  view source on GitHub ↗

Merges the blobs from start to end, not including end, and deletes the blobs between start and end.

Source from the content-addressed store, hash-verified

890// Merges the blobs from start to end, not including end, and deletes
891// the blobs between start and end.
892void TWERD::MergeBlobs(int start, int end) {
893 if (start >= blobs.size() - 1) return; // Nothing to do.
894 TESSLINE* outline = blobs[start]->outlines;
895 for (int i = start + 1; i < end && i < blobs.size(); ++i) {
896 TBLOB* next_blob = blobs[i];
897 // Take the outlines from the next blob.
898 if (outline == NULL) {
899 blobs[start]->outlines = next_blob->outlines;
900 outline = blobs[start]->outlines;
901 } else {
902 while (outline->next != NULL)
903 outline = outline->next;
904 outline->next = next_blob->outlines;
905 next_blob->outlines = NULL;
906 }
907 // Delete the next blob and move on.
908 delete next_blob;
909 blobs[i] = NULL;
910 }
911 // Remove dead blobs from the vector.
912 for (int i = start + 1; i < end && start + 1 < blobs.size(); ++i) {
913 blobs.remove(start + 1);
914 }
915}
916
917#ifndef GRAPHICS_DISABLED
918void TWERD::plot(ScrollView* window) {

Callers 1

MergeAdjacentBlobsMethod · 0.80

Calls 2

sizeMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected