4

I'm working on a little project that does "scan" sheets of paper using a camera (specifically the iPhone camera).

Workflow:

Lets users take pictures of sheets of paper while I will afterwards detect corners/the outline so I know the 4 corner points of the original sheet of paper in the photograph. It is then easy to inverse the perspective transformation of the camera to gain a "flat" image of the photographed sheet of paper.

However, my question is: how do I maintain or even calculate the correct (original) aspect ratio?

Image of UI with detected corners of sheet of paper (can't post images, sorry)

As you can see above I have the coordinates for the corner points and I also know how to construct a matrix to map the top left corner to the point (0,0), the top right corner to (width,0), the bottom right corner to (width, height) and the bottom left corner to (0,height).

The question now is: How do I get the correct width/height aspect ratio the sheet of paper originally has. I'm pretty sure I can figure it out using the angles to determine the perspective transformation but I'm stuck finding the right formula. I also have a hunch that I also would need the focal length of the camera but it would be great not to need that.

Any ideas would be appreciated.

Adil Soomro
  • 36,617
  • 9
  • 98
  • 146
Nicolas
  • 453
  • 5
  • 14
  • Hi,How you achieved this using OpenCV?I got to see Square.C file in the framework, but not able to get it working.Can you help me with detecting the corners of a document. – Ajay Sharma Jan 30 '12 at 06:40

1 Answers1

0

This paper http://research.microsoft.com/en-us/um/people/zhang/papers/tr03-39.pdf

describes the process.

I did some experiments and although the results for a 'synthetic' images were good, with real images (or when I added some noise to the 'detected' corners of synthetic image) the result were unstable - aspect ratio varied considerably.

skuzniar
  • 121
  • 4