Cleaning Up 1-Bit Images
(Document and Medical Imaging toolkits)
Scanned images are often rotated slightly out-of-plane, leading to automated read (OCR, ICR, OMR, Barcode) errors. There are several ways to correct this using LEADTOOLS:
1. LEADTOOLS Deskew functions automatically straighten scanned images by rotating the specified bitmap. LEAD’s proprietary DeskewCheck function is specifically designed to automatically detect and correct alignment errors in scanned bank checks. Deskew options include background color, interpolation type, and rotation speed.
2. Rotate functions adjust the image data. This is the most portable solution, but it is also the slowest. Therefore, this may not be the best solution for very large images.
3. Using ViewPerspective functions, no image data will be altered. LEADTOOLS simply changes the View Perspective of the image so that the origin of the image is altered. Because this method only adjusts a flag (the image data is not touched), it is a very fast. However, some application may not recognize the View Perspective, and the image therefore may not be painted as rotated.
4. If the image is saved in a TIFF format, you can use SetTag functions to adjust the Orientation tag within the TIFF. As for Perspective functions, image data is not touched, but some applications may not recognize the Orientation tag
LBitmapBase::ChangeViewPerspective
Scanned documents often contain a number of undesirable artifacts, including black margins or blank spaces around their borders, dots, blobs, lines, borders and hole punches. LEADTOOLS provides a number of functions that will improve the appearance of scanned documents. AutoTrim functions can be used to remove unwanted blank edges from images. BorderRemove functions remove any or all image borders (black borders surrounding scanned document), with the ability to specify the tolerance level for amount of noise, maximum border size, and variability of border size. Other functions remove speckles, dots, blobs, lines, hole punch marks, inverted text, bumps and nicks:
Each of these functions takes as a parameter a specialized structure that controls the performance of the corresponding removal process. Included in the structure is a set of flags that allows you to obtain a LEAD region or a Windows region that contains all the elements removed from a document. The following callback member functions allow you to provide customized region processing, as well as create your own composite of the removed regions:
LBitmap::HolePunchRemoveCallback
For more information, refer to:
Accounting for View Perspective
Raster Image Functions: Doing Geometric Transformations
Raster Image Functions: Functions That Transform the Region and the Bitmap