Perspective correction

317 views
Skip to first unread message

hiran.suvrat

unread,
May 29, 2012, 12:52:54 PM5/29/12
to tesseract-ocr
Hi Experts,

Is their a function to automatically detect and correct perspective
for text images?

Thanks,
Suvrat

TP

unread,
May 29, 2012, 9:20:49 PM5/29/12
to tesser...@googlegroups.com
On Tue, May 29, 2012 at 9:52 AM, hiran.suvrat <hiran....@gmail.com> wrote:
> Is their a function to automatically detect and correct perspective
> for text images?

Depending on what you mean, Leptonica has the ability to dewarp text
page images [1] (although it currently doesn't seem to work very well
with pages that only have short lines). See dewarptest.c [2] for an
example.

It can also do Projective transforms [3] via pixDeskewLocal() [4]. See
baselinetest.c [5] for an example.

[1] Dewarping Text Pages
http://tpgit.github.com/UnOfficialLeptDocs/leptonica/dewarping.html

[2] http://tpgit.github.com/Leptonica/dewarptest_8c_source.html

[3] http://tpgit.github.com/UnOfficialLeptDocs/leptonica/affine.html#projective-transform

[4] http://tpgit.github.com/Leptonica/baseline_8c_source.html#l00295

[5] http://tpgit.github.com/Leptonica/baselinetest_8c_source.html

TP

unread,
May 30, 2012, 3:41:17 PM5/30/12
to tesser...@googlegroups.com
On Wed, May 30, 2012 at 10:14 AM, hiran.suvrat <hiran....@gmail.com> wrote:
> If I narrow down my problem to this. Suppose I have a image of a text
> at an angle ( Image is not taken from the top of the text) such that
> it forms a trapezoid of the text. What would you suggest to use then?

That would require a perspective transform so use pixDeskewLocal().
But for the best advice you should post a sample image using a
lossless image format like tiff or png (*not* jpeg).
Reply all
Reply to author
Forward
0 new messages