The present invention relates generally to the field of image readers, and more particularly to a method and apparatus for correcting perspective distortions and orientation errors.
The use of portable image readers over fixed-mount image readers is increasing and these portable image readers are seeing applications in many industries. One of the main challenges with portable image readers however is the perspective distortion caused by inconsistent image reading positions. With fixed-mount systems, such as a document scanner, the image reader is placed in such a manner that the optical path of the image reader is perpendicular to the image plane. With portable systems, however, the position of the image reader is dependent on a human operator. It is difficult for an operator to know the ideal point from where to capture an image of a target such as a document. More often than not, the user captures the image at an oblique angle, i.e. the image reader is not in a plane parallel to the plane of the document, and the captured image is skewed.
Accordingly, the image data may be uploaded to a personal computer for processing by various correction algorithms. The algorithms are employed to correct the distortion effects associated with off-angle images of documents. The correction algorithms require a user to manually identify the corners of a region of a captured image. Many image readers use geometric transforms such as affine transformations during post-processing of the image to correct for perspective distortions. In order to apply these transforms, the edges or corners of the image need to be defined. By measuring the spatial displacement of the identified corners from desired positions associated with a rectangular arrangement, an estimation of the amount of distortion is calculated. The correction algorithm then processes the imaged document to possess the desired perspective and size as necessary.
U.S. Patent Applications 2003/0156201—Zang published Aug. 21, 2003; 2004/0012679—Fan published Jan. 22, 2004 and 2004/0022451—Fugimoto published Feb. 5, 2004 discuss automatic methods for identifying the corner or edges of the document based on statistical models. While these methods do not require user input to manually identify the document corners, additional complexity is added to the image reader. Also, the degree of accuracy is not the same when the locations of the corners are estimated positions. A document can also contain many different types of objects such as 1 or 2-dimensional codes, text, written signatures, etc. As a result it may be difficult to define the boundaries of the document by statistical methods.
Further, the prior art accounts for correction of perspective distortion, but cannot correct for orientation. The operator may not always align the image reader in the same orientation as the document so the captured image may require rotation. Many image readers have rectangular aspect ratios so it is necessary at times to rotate the image reader by 90 degrees with respect to the document in order to “fill” the field of view (FOV) of the image reader with the document.
Therefore there is a need for an image reader that can automatically correct for both perspective distortion and orientation.
The present invention is directed to a method and apparatus for correcting perspective distortion in an image captured by an image reader wherein the captured image has a number of special markers located on the boundary of the image having a predetermined shape. Distortion is corrected by calculating the smallest predetermined shape that encloses all of the special boundary markers, building a geometric transform to map the location of the special markers in the captured image to corresponding locations on the predetermined shape and applying the geometric transform to the captured image. Further, the special boundary markers may include a unique identifier marker different from the other special boundary markers, which is used to correct orientation errors in the captured image.
In accordance with a specific aspect of the invention, the predetermined shape of the image is a rectangle and the special boundary markers are corner markers. Further, the geometric transform comprises affine transformations.
The present invention is further directed to a method and apparatus for positioning an image reader having a rectangular field of view to avoid perspective distortion in a captured image wherein the captured image has special boundary markers located at the corners of the image having a rectangular shape. The image reader is positioned by capturing an image, calculating the distance between the special boundary markers and the field of view corners and determining if the distances are all the same within a predetermined tolerance. If the distances are not the same the image reader is repositioned by the operator and the image recaptured until the distances are all the same within the predetermined tolerance. Further, the special boundary markers may include a unique identifier marker different from the other special boundary markers, which is used to correct orientation errors in the captured image.
The invention is further directed to a method and apparatus for producing an image of a substantially rectangular target having special boundary markers at the corners with one of the markers being a unique corner marker. The image is produced by capturing an image using an image reader having a rectangular field of view, positioning the reader as a function of the distances from the markers to corners of the field of view and correcting orientation errors of the image using the unique corner marker. Orientation errors may be corrected by rotating the captured image. Further, perspective distortion may be corrected using the special boundary markers.
The present invention is also directed to a method and apparatus for producing an image of a substantially rectangular target having special boundary markers at the corners with one of the markers being a unique corner marker. The image is produced by capturing an image using an image reader, correcting perspective distortion on the captured image using the special boundary markers, correcting orientation errors of the image using the unique corner marker and processing the image. The perspective distortion may be corrected by calculating the smallest predetermined shape that encloses all of the special boundary markers, building a geometric transform to map the location of the special markers in the captured image to corresponding locations of the predetermined shape and applying the geometric transform to the captured image.
In accordance with another aspect of this invention, orientation errors in the image may be corrected by rotating the captured image.
In accordance with a specific aspect of this invention, the special boundary markers are polygon shapes.
Other aspects and advantages of the invention, as well as the structure and operation of various embodiments of the invention, will become apparent to those ordinarily skilled in the art upon review of the following description of the invention in conjunction with the accompanying drawings.
The invention will be described with reference to the accompanying drawings, wherein:
A conventional image reader, such as a portable image reader 1 is shown in the simplified diagram of
The analog information produced by image capture device 2 is converted to digital information by A/D conversion unit 4. A/D conversion unit 4 may convert the analog information received from image capture device 2 in either a serial or parallel manner. The converted digital information may be stored in memory 5 (e.g., random access memory or flash memory). The digital information is then processed by processor 6. Additionally or alternatively, other circuitry (not shown) may be utilized to process the captured image such as an application specific integrated circuit (ASIC). User interface 7 (e.g., a touch screen, keys, and/or the like) may be utilized to edit the captured and processed image. The image may then be provided to output port 8. For example, the user may cause the image to be downloaded to a personal computer (not shown) via output port 8.
Referring to step 25 of
Once it is established that all markers are present on the captured image, correction of the captured image begins. The first step of the perspective correction algorithm is to calculate 27 the smallest rectangle that encloses all the markers of the captured image.
The second step of the perspective correction algorithm is to build 28 a perspective transformation matrix that will map the markers of the captured image to the corresponding corners of the smallest rectangle. This requires the use of geometric transforms such as affine transformations. This technique is known to those skilled in the art and will not be discussed further here.
The third step of the perspective correction algorithm is to apply 29 the transformation, which will move the markers of the captured image to the corners of the smallest rectangle that encloses the captured image. The last step of the correction algorithm is to cut 30 the rectangular part of the image, the part of the image defined by the smallest rectangle, from the rest of the captured image. This rectangular image is then made the principal image. In reference to
The final step in the process outlined in
A further embodiment of the present invention incorporates perspective distortion detection that will reduce or may even eliminate the need for perspective distortion correction. This is done by determining a perfect alignment condition in which to capture the image. If the user can be guided as to how to correctly align the image reader over the target, perspective distortion in the resultant image can be avoided.
The next step of the process is to determine if the perfect alignment condition is switched on or enabled 52 in the image reader. If it is enabled, the next step 53 calculates the distance between the corners of the FOV 45 and the markers 36, 37, 38 and 39, i.e. the distance between the upper left hand corner of the FOV 45 and the upper left hand marker 36 and so on. Once the distances are measured for each of the four corners, the algorithm determines 54 if the distances between each marker and the corresponding FOV corner are all the same. If they are all the same, or within a predetermined tolerance to each other, the image is considered to be distortion free and the process continues to step 55. In this case, the image reader will provide “positive” feedback to the operator such as a LED indicator or an audible signal. If the distances are not all the same, the image reader will provide “negative” feedback, to indicate to the operator that distortion exists in the captured image and to re-capture the image. The algorithm then returns to step 51. This feedback is meant to guide the operator to manually correct the image reader alignment. This can be done through a number of ways such as left/right and/or top/bottom LED indicators. If the image reader needs to be moved in a particular direction, the appropriate LED will illuminate. Another option is the use of audible tones. As the operator moves the image reader, the tones can indicate if the operator is approaching proper alignment or increasing the amount of distortion.
Step 55 transfers the image to a host processor such as a personal computer for image processing. Step 55 is optional if the capability is present for the image reader itself to perform any post-processing.
The last step of this process is orientation determination and correction 56. Upon examination of the location of the orientation reference corner marker, the image may require rotation.
If it was determined that the perfect alignment condition was turned off or disabled in step 52, the image is transferred 57 to a host processor for image processing. This step is optional if the post-processing capability is present on the image reader. The next step is to correct 58 for perspective distortion by implementing the perspective distortion correction algorithm outlined in
It is also to be noted that it is within the present scope of this invention to correct 58 to correct the image for perspective distortion after step 55. This would be particularly desirable to correct for the minor perspective distortion permitted by the tolerances in step 54.
From the embodiments described above, the present invention has the advantage of being simpler than the prior art by avoiding complex corner/edge detecting algorithms. The accuracy is also higher since the corners of the document are identifiable by the special markers, whereas the prior art uses statistical methods to provide an estimate of the document corners.
A further advantage of the present invention is the detection of perspective distortion, which gives feedback to the operator for correct positioning of the image reader. Perspective distortion correction may not be necessary if the operator can be guided into capturing a distortion-free image.
While the invention has been described according to what is presently considered to be the most practical and preferred embodiments, it must be understood that the invention is not limited to the disclosed embodiments. Those ordinarily skilled in the art will understand that various modifications and equivalent structures and functions may be made without departing from the spirit and scope of the invention as defined in the claims. Therefore, the invention as defined in the claims must be accorded the broadest possible interpretation so as to encompass all such modifications and equivalent structures and functions.