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

Method CollectEdges

deps/tesseract/ccstruct/blobs.cpp:765–789  ·  view source on GitHub ↗

For all the edge steps in all the outlines, or polygonal approximation where there are no edge steps, collects the steps into the bounding_box, llsq and/or the x_coords/y_coords. Both are used in different kinds of normalization. For a description of x_coords, y_coords, see GetEdgeCoords above.

Source from the content-addressed store, hash-verified

763// normalization.
764// For a description of x_coords, y_coords, see GetEdgeCoords above.
765void TBLOB::CollectEdges(const TBOX& box,
766 TBOX* bounding_box, LLSQ* llsq,
767 GenericVector<GenericVector<int> >* x_coords,
768 GenericVector<GenericVector<int> >* y_coords) const {
769 // Iterate the outlines.
770 for (const TESSLINE* ol = outlines; ol != NULL; ol = ol->next) {
771 // Iterate the polygon.
772 EDGEPT* loop_pt = ol->FindBestStartPt();
773 EDGEPT* pt = loop_pt;
774 if (pt == NULL) continue;
775 do {
776 if (pt->IsHidden()) continue;
777 // Find a run of equal src_outline.
778 EDGEPT* last_pt = pt;
779 do {
780 last_pt = last_pt->next;
781 } while (last_pt != loop_pt && !last_pt->IsHidden() &&
782 last_pt->src_outline == pt->src_outline);
783 last_pt = last_pt->prev;
784 CollectEdgesOfRun(pt, last_pt, denorm_, box,
785 bounding_box, llsq, x_coords, y_coords);
786 pt = last_pt;
787 } while ((pt = pt->next) != loop_pt);
788 }
789}
790
791// Factory to build a TWERD from a (C_BLOB) WERD, with polygonal
792// approximation along the way.

Callers

nothing calls this directly

Calls 3

CollectEdgesOfRunFunction · 0.85
FindBestStartPtMethod · 0.80
IsHiddenMethod · 0.80

Tested by

no test coverage detected