Deskew and Resize

Discussions about image processing and document imaging.
Post Reply
eCandidus
Posts: 3
Joined: Mon Oct 29, 2012 12:18 am

Deskew and Resize

Post by eCandidus » Mon Oct 13, 2014 12:58 am

All:

I do not know where exactly to post this question, but I think this is my best bet.

What I am looking for is to be able to accept an image where the "corners" will be like the ones in the attached file. I would like to be able to tell the process the desired Y position of the top and bottom line and the desired x position of the left and right lines and have the process deskew and expand/compress the image until the giodes match the values that I passed in.

The use is to then use the OMR and Barcode decode functions in given areas to get that information.

You may have this functionality built into GdPicture, and the deskewing portion I already do. The resizing is the issue. What we have found is that when forms are faxed (yes, we still have those types of users), the image size may change and sometimes drastically if a third party FAX service is involved.

Thanks.
Attachments
sample image.jpg
sample image.jpg (3.93 KiB) Viewed 3398 times

SamiKharma
Posts: 352
Joined: Tue Sep 27, 2011 11:47 am

Re: Deskew and Resize

Post by SamiKharma » Tue Oct 14, 2014 3:03 pm

Hi,

My guess is that you are using those corners to define an area of interest, and then resize the area of interest into a defined template size, so that the recognition parameters (positions) match.

There are several issues with the above technique:
1. The opposite lines are good, but they do not account for stretching due to scanning from feeders (it is not uniform across image height - assuming horizontal position of the paper on the feeder tray).
2. Most OMR forms use Anchors (black or rectangular) boxes. They search for those boxes in the scanned image, measure the translation, and translate the detection parameters (positions) according to the shift in the x-axis and the y-axis.
In fact GdPicture has a specific anchoring mechanism just for that.
3. Resizing will always cause more problems than solve. DPI to resized image will not be accurate as already scanned image. Interpolation mode will also play a big factor especially at the lower dpi images.
4. Finally, GdPicture unfortunately does not return line positions for its internal line detection (still under consideration to implement or not). Even so, combining the line detection positions with points 1 and 4 will not yield accurate results in practice.

I highly suggest you adapt an anchoring methodology (which is tested and the most commonly used in OMR systems).

Best,
Sami

eCandidus
Posts: 3
Joined: Mon Oct 29, 2012 12:18 am

Re: Deskew and Resize

Post by eCandidus » Tue Oct 14, 2014 9:55 pm

Sami:

Thank you for your response. After thinking about this, if I substitute three squares in place of the cornered lines, they form anchors. My (hopefully last) question is: In the CreateAnchorTemplace call, how much extra area around the anchors should I provide for the algorithm to work best. Attached is a mini version of what I mean by the squares.
Attachments
sample.png
sample.png (1.77 KiB) Viewed 3387 times

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest