I refer to the post viewtopic.php?f=17&t=113&hilit=calibration, in which a calibration point grid is suggested to do a calibrated dewarping if the camera has a fixed position with respect to the scanned page. There are other approaches like viewtopic.php?f=13&t=784 to automatically recognize calibration information for dekeystoning. The latter seems appropriate for setups where the relative position is changing during scanning.
I have written a small command line program, which is capable to correct keystoning, page warping and camera lense distortion automatically by using a calibration point grid as suggested in the first referenced post from above. In the following posts I will discuss the approach taken and finally will supply the program, which is GPLed.
The general setup is the following:
Your scanning setup guarantees that the camera is in fixed geometrical position with respect to the platen. In contrast to all other setups, the platen need not be flat! A non-flat platen seems strange at first sight, but can be advantageous to avoid blur. I have estimated an absolute depth of focus of about 1 cm for a camera like mine (a Powershot A490), which seems to be roughly independent from the distance of the camera and the platen. Therefore, with the pythagorean theorem you can show, that noticeable blurring occurs quite fast for usual camera setups. If dR denotes the maximal depth of focus, R the vertical camera to platen distance and r the radius of a circle on a page with focused content, then the formula
Code: Select all
r = sqrt(dR * (2*R + dR))
- R = 44 cm ==> r = 9.4 cm
- R = 60 cm ==> r = 11 cm
- R = 80 cm ==> r = 12.6 cm
- R = 100 cm ==> r = 14.1 cm
the platen is part of a cylindrical surface, 2*r is the maximal height of a page fully in focus!
Therefore I plan to construct a scanner with a cylindrical platen to enhance sharpness.
The distortion will be no problem for me as the following posts should demonstrate.