Sometimes images with barcodes cannot be read as-is. Many times you can get them to read by simply converting an image to black and white and running L_IntensityDetectBitmap (CLIB - LBitmap::IntensityDetect / .NET - IntensityDetectCommand). However, this isn't always sufficient. These demos are meant to show another combination of preprocessing you can do that works for many images.
The first function is L_AutoColorLevelBitmap (CLIB - LBitmap::AutoColorLevel / .NET - AutoColorLevelCommand). This function helps images with barcodes because it makes dark portions darker and light portions lighter. You can tweak this function by using one of the different types of auto leveling (Level, Contrast, or Intensity) and also with the White Clip and Black Clip. In this demo, I used the Level type of auto leveling and used 30% white and 1% black.
The second function is L_DynamicBinaryBitmap (CLIB - LBitmap::DynamicBinary / .NET - DynamicBinaryCommand). This function is similar to L_IntensityDetect in that it converts the image to black and white, but it gives you a little more control. You can tweak this by changing the Dimension and Local Contrast. In this demo, I used a Dimension of 9 and a Local Contrast of 16.
Attached are four images which you probably won't be able to read the barcode without preprocessing. Additionally, there are three identical projects: VC++ 8 using the LEADTOOLS API, VC++ 8 using the LEADTOOLS Class Library, C# 2.0 using the LEADTOOLS .NET.
NOTE: To use this demo, you will need to unlock support for BARCODES_1D, BARCODES_DATAMATRIX_READ, BARCODES_PDF_READ, and LTPRO. If you are evaluating the toolkit, then you need not worry about unlocking. If you have purchased the toolkit but do not have these unlock keys, you can use the NAG kernel which will not require you to unlock anything (please contact
support@leadtools.com if you do not know how to use the NAG kernel). If you have purchased the toolkit and the necessary barcode add-ons, you must contact
sales@leadtools.com to get them.
Here are some additional functions not covered in these demos which are useful for pre-processing images to improve barcode recognition results:
L_ColorLevelBitmap (CLIB - LBitmap::ColorLevel / .NET - ColorLevelCommand)
L_AutoBinaryBitmap (CLIB - LBitmap::AutoBinary / .NET - AutoBinaryCommand)
L_HistoEqualizeBitmap (CLIB - LBitmap::HistoEqualize / .NET - HistogramEqualizeCommand)
L_LightControlBitmap (CLIB - LBitmap::LightControl / .NET - LightControlCommand)
If you have any additional questions or problems with these demos, please send an email to
support@leadtools.com.