On Fri, Jan 11, 2013 at 4:19 PM, TP <[email protected]> wrote:
> On Thu, Jan 10, 2013 at 10:31 PM, newbie <[email protected]> wrote:
>> I am trying to scale the original image larger by pixScale function of
>> Leptonica for the input of Tesseract OCR, however, I see that the resolution
>> of dest image is increased as well. For example,  I have pix with 300DPI,
>> but the if I scale to 3x, then the dest image's resolution will be 900 DPI.
>> I have no idea if it is good or bad as I think 300 DPI is good enough.
>> Could you please advise me which is the best solution for input image for
>> Tesseract?
>
> Offhand, I don't know why leptonica does this but for example, looking
> at pixScaleGrayLI(), I can see:
>
>     pixScaleResolution(pixd, scalex, scaley);
>
> This is in pix1.c, and simply changes the resolution without messing
> with anything else. So, if you don't like 900dpi, you can just call
> pixSetResolution() to set them back to 300.

Actually, after thinking about it for a few seconds, what leptonica
does makes perfect sense. When you upsample an image, you presumably
want it to keep its "physical size", so when you upscale by 3 you also
have increase the resolution by 3.

Remembering your earlier questions, the real issue is that your
original image didn't properly set the dpi. IIRC that image was
probably *not* 300dpi (which leptonica sometimes defaults to if it
doesn't know the resolution) but more like 100dpi. If you use
pixSetResolution() on that image to set the dpi to 100, then after
upscaling by 3, you get the desired final 300 dpi.

-- 
You received this message because you are subscribed to the Google
Groups "tesseract-ocr" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/tesseract-ocr?hl=en

Reply via email to