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

Method BlockPolygon

deps/tesseract/ccmain/pageiterator.cpp:367–383  ·  view source on GitHub ↗

Returns the polygon outline of the current block. The returned Pta must * be ptaDestroy-ed after use. */

Source from the content-addressed store, hash-verified

365/** Returns the polygon outline of the current block. The returned Pta must
366 * be ptaDestroy-ed after use. */
367Pta* PageIterator::BlockPolygon() const {
368 if (it_->block() == NULL || it_->block()->block == NULL)
369 return NULL; // Already at the end!
370 if (it_->block()->block->poly_block() == NULL)
371 return NULL; // No layout analysis used - no polygon.
372 ICOORDELT_IT it(it_->block()->block->poly_block()->points());
373 Pta* pta = ptaCreate(it.length());
374 int num_pts = 0;
375 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward(), ++num_pts) {
376 ICOORD* pt = it.data();
377 // Convert to top-down coords within the input image.
378 float x = static_cast<float>(pt->x()) / scale_ + rect_left_;
379 float y = rect_top_ + rect_height_ - static_cast<float>(pt->y()) / scale_;
380 ptaAddPt(pta, x, y);
381 }
382 return pta;
383}
384
385/**
386 * Returns a binary image of the current object at the given level.

Callers

nothing calls this directly

Calls 12

ptaCreateFunction · 0.85
ptaAddPtFunction · 0.85
poly_blockMethod · 0.80
pointsMethod · 0.80
dataMethod · 0.80
blockMethod · 0.45
lengthMethod · 0.45
mark_cycle_ptMethod · 0.45
cycled_listMethod · 0.45
forwardMethod · 0.45
xMethod · 0.45
yMethod · 0.45

Tested by

no test coverage detected