Cleaning Up 1-Bit Images

(Document and Medical Imaging toolkits)

Image Skew and Rotation

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. The Deskew functions have options to use algorithms specifically designed to automatically detect and correct alignment errors in scanned bank checks. Other 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 applications 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 with the perspective functions, image data is not touched. Some applications may not recognize the Orientation tag

L_DeskewBitmap
L_DeskewBitmapExt
L_DetectBitmapDeskewOrientation
L_HighQualityRotateBitmap
L_RotateBitmap
L_RotateBitmapViewPerspective

Imaging Artifacts

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, data entry rakes, inverted text, bumps, rakes, and nicks:

L_BorderRemoveBitmap
L_DotRemoveBitmap
L_HolePunchRemoveBitmap
L_InvertedTextBitmap
L_LineRemoveBitmap
L_AutoLineRemove
L_SmoothBitmap
L_RakeRemoveBitmap
L_InvertedPageBitmap

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:

BORDERREMOVECALLBACK
DOTREMOVECALLBACK
HOLEPUNCHREMOVECALLBACK
INVERTEDTEXTCALLBACK
LINEREMOVECALLBACK
SMOOTHCALLBACK
RAKEREMOVECALLBACK

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
Removing Noise

Help Version 22.0.2023.7.11
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.