views:

235

answers:

2

I am working in OMR project and we are using C#. When we come to scan the answer sheets, the images are skewed. How can we deskew them?

+1  A: 

Are you sure it's "skew" rather than "rotation" (rotation preserves angles, skew doesn't).

  • Use some sort of registration mark (in at least two places) which you can recognize even when rotated.
  • Find the coordinates of these marks and calculate the rotation angle.
  • Apply a rotation transformation matrix to the image.
Ben Voigt
+1  A: 

Disclaimer: I work at Atalasoft, DotImage Document Imaging can do this with a couple of lines of code.

Deskew is a term of art that describes what you are trying to do. As Ben Voigt said, it's technically rotation, not skew -- however, you will find algorithms under automatic deskew if you search.

The normal way to do this is to do a hough transform to look for the prevalent lines in the image. With normal documents, many of them will be orthogonal to the sides of the paper.

Lou Franco