This Technical tip explains how to perform faster and better barcode image recognition using Aspose.This tip submitted by sherazam on 2013-08-28 00:14:17. It has been viewed 4318 times.
Rating of 8.1 with 8 votes
This Technical tip explains how to perform faster and better barcode image recognition using Aspose.BarCode for .NET. Aspose.BarCode for .NET provides better and faster barcode recognition using the following image processing algorithms:
• Median smoothing image processing (RecognitionHints.ImageBinarizationHints.MedianSmoothing)
• HLS image processing (RecognitionHints.ImageBinarizationHints.HLS)
• Grayscale image processing (RecognitionHints.ImageBinarizationHints.Grayscale)
Median smoothing: MedianSmoothing technique gives a perfect result. In more complicated images, less data will be lost by taking the median. MedianSmoothing removes the noise from the image while preserving the image edges.
HLS: HLS is also a Color space similar to RGB. But instead of red, green and blue components, HLS contain Hue, Luminance & Saturation components. It's a color space in which the Hue, saturation and luminance of a color can be separated and modified.
GrayScale: It converts image to grayscale. This processing technique can be useful while detecting bar codes from scanned or slightly damaged images. The probability of bar code detection will increase by this setting.
The following code snippet shows how to use median smoothing, HLS and gray-scale image processing techniques while recognizing the barcode:
string image = @"code39Extended.jpg";
// create an instance of BarCodeReader and set image and symbology type to recognize
BarCodeReader reader = new BarCodeReader(image, BarCodeReadType.Code39Standard);
// set grayscale image processing
reader.ImageBinarizationHints = RecognitionHints.ImageBinarization.Grayscale;
// try to recognize all possible barcodes in the image
// display the codetext
Console.WriteLine("Codetext: " + reader.GetCodeText());
// close the reader
Dim image As String = "code39Extended.jpg"
' create an instance of BarCodeReader and set image and symbology type to recognize
Dim reader As BarCodeReader = New BarCodeReader(image, BarCodeReadType.Code39Standard)
' set grayscale image processing
reader.ImageBinarizationHints = RecognitionHints.ImageBinarization.Grayscale
' try to recognize all possible barcodes in the image
Do While reader.Read()
' display the codetext
Console.WriteLine("Codetext: " & reader.GetCodeText())
' close the reader
Overview: Aspose.BarCode for .NET
Aspose.BarCode is a .NET component for generation and recognition of Linear and 2D barcodes on all kinds of .NET applications. It supports WPF with 29+ Barcode symbologies like OneCode, QR, Aztec, MSI, EAN128, EAN14, SSCC18, Code128, Code39, Postnet, MarcoPDF417, Datamatrix, UPCA etc. Other features include barcode insertion in PDF, Word and Excel documents. Also take image output in BMP, GIF, JPEG, PNG and WMF formats. You can also control image styles such as background color, bar color etc.
Help your fellow programmers! Add a tip!