public class PageIterator extends Object
Modifier and Type | Method and Description |
---|---|
void |
begin()
Resets the iterator to point to the start of the page.
|
int[] |
getBoundingBox(int level)
Get bounding box: x, y, w, h
|
Rect |
getBoundingRect(int level)
Get a bounding box as an Android Rect.
|
boolean |
next(int level)
Moves to the start of the next object at the given level in the page
hierarchy, and returns false if the end of the page was reached.
|
public void begin()
public boolean next(int level)
NOTE that TessBaseAPI.PageIteratorLevel.RIL_SYMBOL
will skip non-text blocks,
but all other TessBaseAPI.PageIteratorLevel
level values will visit each
non-text block once. Think of non text blocks as containing a single
para, with a single line, with a single imaginary word.
Calls to this method with different levels may be freely intermixed.
This function iterates words in right-to-left scripts correctly, if the appropriate language has been loaded into Tesseract.
level
- the page iterator level. See TessBaseAPI.PageIteratorLevel
.false
if the end of the page was reached, true
otherwise.public int[] getBoundingBox(int level)
============= Accessing data ==============.
Coordinate system:
Returns the bounding rectangle of the current object at the given level. See comment on coordinate system above.
The returned bounding box may clip foreground pixels from a grey image.
level
- the page iterator level. See TessBaseAPI.PageIteratorLevel
.public Rect getBoundingRect(int level)
level
- the page iterator level. See TessBaseAPI.PageIteratorLevel
.getBoundingBox(int)