[Urgent] Find out coordinates and bounding box of a word/phrase/paragraph

2,173 views
Skip to first unread message

jdevelop

unread,
Jan 6, 2010, 12:37:33 PM1/6/10
to tesseract-ocr
Hello, all!

Can somebody please advice - is it possible to get the coordinates and
bounding boxes of words, recognized by tesseract? If so - can somebody
please point me to where I should learn more about it?

Ideally, the output (or API callback) should contain the word itself,
the [X,Y] of upper-left corner and [X,Y] of bottom-right one.

Thank you all in advance!

--
Eugene

patrickq

unread,
Jan 7, 2010, 2:22:55 PM1/7/10
to tesseract-ocr
Yes, look up the definition of TesseractExtractResults: it returns the
set of boxes for all characters it recognized, with blank characters
(ascii 32) between words or lines (you have to map to a space or to a
newline based on the X & Y coordinates of the box before and after the
delimiter). A "word" would be the set of individual boxes between two
delimiters and if you wish to draw a box around the entire word, you
can just make one up from the min/max X & Y values from the set of
individual character boxes. Disclaimer: there may be an API I don't
know that returns the word boxes ready-made.

A word of caution: the Tesseract space detection is so-so and is wrong
IMHO about 5-10% of the time.

Patrick

jdevelop

unread,
Jan 7, 2010, 2:48:45 PM1/7/10
to tesseract-ocr
On Jan 7, 9:22 pm, patrickq <patrick.questemb...@gmail.com> wrote:
> Yes, look up the definition of TesseractExtractResults: it returns the
> set of boxes for all characters it recognized, with blank characters
> (ascii 32) between words or lines (you have to map to a space or to a
> newline based on the X & Y coordinates of the box before and after the
> delimiter).

Hello, Patrick!

Thank you for the quick response. May be you can also tell me what are
the units
for x0,y0,x1,y1 used? Are those pixels or something else?

static int TesseractExtractResult(char** string,
int** lengths,
float** costs,
int** x0,
int** y0,
int** x1,
int** y1,
PAGE_RES* page_res);

Thank you!

--
Eugene

patrickq

unread,
Feb 5, 2010, 5:46:24 PM2/5/10
to tesseract-ocr
Looks like I missed that one ... better late than never! Yes, the
coordinates are returned in units of pixels.

parv gupta

unread,
Oct 19, 2017, 2:31:47 PM10/19/17
to tesseract-ocr
can anyone tell me the position of this word
lipsum(9)
Reply all
Reply to author
Forward
0 new messages