Boxes have wrong coordinates

612 views
Skip to first unread message

Jonathan

unread,
Nov 8, 2009, 6:17:48 PM11/8/09
to tesseract-ocr
I used the following command on an image to create a box file:

tesseract wrong_boxes.tif boxes.txt -l eng nobatch makebox

unfortunately, the boxes are too wide and moved to the right.
It seems to me like a bug.

I verified it using my own box file parser (screenshot), by using gimp
to verify the coordinates and
finally by using the python trainer provided on the tesseract
homepage.

http://groups.google.com/group/tesseract-ocr/web/wrong_boxes.tif.tar.gz
http://groups.google.com/group/tesseract-ocr/web/wrong_boxes.png
http://groups.google.com/group/tesseract-ocr/web/wrong_boxes.box

Can you give me a clue what I did wrong or confirm that it is a bug?

Have a nice day,
Jonathan

wdingus

unread,
Nov 28, 2009, 10:15:34 PM11/28/09
to tesseract-ocr
Agreed... I was just about to post about this and went looking to see
if anyone else had reported it. For me I just compiled a 3.00 SVN
version of Tesseract on a Fedora12 x86_64 box. I had to do ./
runautoconf which someone else commented on, to get it to compile,
thanks for that...

Anyway, I OCR a page and use makebox to get character coordinates. I
used ImageMagick to draw a box over one of the character positions:

$ convert image.tif -draw 'rectangle 1047,1205,1059,1221' newimage.tif

The results on every test I've tried so far are correct horizonatlly
but vertically they're either too high or too low.

Any suggestions anyone?

Thanks...

On Nov 8, 6:17 pm, Jonathan <jogl...@gmail.com> wrote:
> I used the following command on an image to create a box file:
>
> tesseract wrong_boxes.tif boxes.txt -l eng nobatch makebox
>
> unfortunately, the boxes are too wide and moved to the right.
> It seems to me like a bug.
>
> I verified it using my own box file parser (screenshot), by using gimp
> to verify the coordinates and
> finally by using the python trainer provided on the tesseract
> homepage.
>
> http://groups.google.com/group/tesseract-ocr/web/wrong_boxes.tif.tar.gzhttp://groups.google.com/group/tesseract-ocr/web/wrong_boxes.pnghttp://groups.google.com/group/tesseract-ocr/web/wrong_boxes.box

Eugene Reimer

unread,
Nov 28, 2009, 10:40:05 PM11/28/09
to tesser...@googlegroups.com
Both your experiences sound like variations of the issue I reported for
version 2.03, and again for 2.04. See my email from 2009-07-23 05:15,
and the "issue" report:
http://code.google.com/p/tesseract-ocr/issues/detail?id=223

In my examples the box-coordinates had sensible X-values, but the
Y-coordinates were either correct or too low by some 12-pixels. From
your reports, there are also other kinds of X-Y errors.

Ray Smith

unread,
Nov 30, 2009, 12:17:06 AM11/30/09
to tesser...@googlegroups.com

Sounds like a mixup with topdown vs bottomup coordinates. The tesseract coordinates have the origin at the bottom-left.

Ray.

On Nov 28, 2009 7:40 PM, "Eugene Reimer" <ere...@shaw.ca> wrote:

Both your experiences sound like variations of the issue I reported for
version 2.03, and again for 2.04.  See my email from 2009-07-23 05:15,
and the "issue" report:
   http://code.google.com/p/tesseract-ocr/issues/detail?id=223

In my examples the box-coordinates had sensible X-values, but the
Y-coordinates were either correct or too low by some 12-pixels.  From
your reports, there are also other kinds of X-Y errors.


wdingus wrote, On 2009-11-28 21:15:

>Agreed... I was just about to post about this and went looking to see >if anyone else had reported...

Eugene Reimer

unread,
Nov 30, 2009, 1:14:42 AM11/30/09
to tesser...@googlegroups.com
Nope - that part is perfectly clear, and obvious to all concerned I'm
sure - at least it is to me.


Ray Smith wrote, On 2009-11-29 23:17:

> Sounds like a mixup with topdown vs bottomup coordinates. The
> tesseract coordinates have the origin at the bottom-left.
>
> Ray.
>
>> On Nov 28, 2009 7:40 PM, "Eugene Reimer" <ere...@shaw.ca
>> <mailto:ere...@shaw.ca>> wrote:
>>
>> Both your experiences sound like variations of the issue I reported for
>> version 2.03, and again for 2.04. See my email from 2009-07-23 05:15,
>> and the "issue" report:
>> http://code.google.com/p/tesseract-ocr/issues/detail?id=223
>>
>> In my examples the box-coordinates had sensible X-values, but the
>> Y-coordinates were either correct or too low by some 12-pixels. From
>> your reports, there are also other kinds of X-Y errors.
>>
>>
>> wdingus wrote, On 2009-11-28 21:15:
>>
>> >Agreed... I was just about to post about this and went looking to
>> see >if anyone else had reported...
>>
> --
>
> You received this message because you are subscribed to the Google
> Groups "tesseract-ocr" group.
> To post to this group, send email to tesser...@googlegroups.com.
> To unsubscribe from this group, send email to
> tesseract-oc...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/tesseract-ocr?hl=en.


patrickq

unread,
Nov 30, 2009, 8:44:53 AM11/30/09
to tesseract-ocr
Indeed - I am experiencing illegal box coordinates in about 40% of the
images I scan (I am using Tesseract 3.0). You can find such an example
on:
http://www.scanbizcards.com/IMG_0735.JPG
and the resulting boxes (after reducing image size by 2 along X and Y
dimension) on:
http://www.scanbizcards.com/IMG_0735-boxes.JPG

As you can see, the bottom wide box cuts a phone number in two near
the top of the box. This is because the box returned is:
[left=0,top=338,width=1024,height=351]. If you trust the "top" value
of the box, and substract the height minus one (351-1) from it to
compute y0, you will get precisely -12 as Eugene mentioned.

I just switched my code to trust the height instead, which avoids
getting a negative value for y0. This gets me a higher y1=350
(essentially setting y0=0 and top=height-1) which by the way cuts the
phone number less but still a bit so I think I am still not getting
the correct values.

Patrick

On Nov 30, 1:14 am, Eugene Reimer <erei...@shaw.ca> wrote:
> Nope - that part is perfectly clear, and obvious to all concerned I'm
> sure - at least it is to me.
>
> Ray Smith wrote, On 2009-11-29 23:17:
>
> > Sounds like a mixup with topdown vs bottomup coordinates. The
> > tesseract coordinates have the origin at the bottom-left.
>
> > Ray.
>
> >> On Nov 28, 2009 7:40 PM, "Eugene Reimer" <erei...@shaw.ca

Yoann Nicod

unread,
Dec 7, 2016, 11:29:59 AM12/7/16
to tesseract-ocr
Hello,

I am experiencing very similar issues, have everyone found a workaround for this ?
Reply all
Reply to author
Forward
0 new messages