The registration and skew information of a document about to be scanned are detected
prior to capturing the entire image of the document. Two sensors, a fixed distance
apart, are used to detect the document skew. A third sensor is used to detect the
edge position of the document. Paper sensors in the Automatic Document Feeder (ADF)
are used to determine the document size. The data from the skew sensors are used
to calculate the required skew correction angle and direction by which to rotate
the image. The document edge position information together with skew information
is used to determine the exact location of a corner of the document. This information
is used to correct skewed image in real-time, during scanning the document.