Barcode Xpress for .NET Framework v13.9 - Updated
Recognize Barcode
Developer Guide > How To > Recognize Barcode

Once your image has been acquired and pre-image processing has been performed to recognize the barcode on the image, the following properties must first be set:

Checks Before Barcode Recognition

If possible, the following properties should be set before the detection process is started:

Property Description
InkColor The default barcode color is black.
Orientation The default barcode orientation is horizontal/vertical orientations.
BarcodeTypes The type of barcodes you want to detect. The default is all 1D barcodes. See the BarcodeTypes property for specific identification of barcode types that must be explicitly set to be recognized, and how to speed up barcode detection for known barcode types. If the barcode image quality is poor (i.e. less than 300 dpi), set the BarcodeTypes property to the specific barcode type in order to obtain accurate results.
MaximumBarcodes Sets the maximum number of barcodes that will be detected. The default is 100. If you know how many barcodes you expect to find, set the MaximumBarcodes to that value, and Barcode Xpress will stop looking once that number is found.

Once these properties are set you are ready to recognize the barcode on the image.

Barcode Xpress detects all barcodes in an image and gives you complete details about them.

If you know where on the image the barcodes reside, setting the Area values to define a smaller rectangular area on your image will speed up processing. By default, these values are set to 0 which tells Barcode Xpress to search the entire image automatically.

Supported Barcodes for Recognition

Barcodes supported for recognition are listed in the Barcode Xpress Overview. The edition you have enabled will determine exact barcodes.

Once the BarcodeTypes property has been determined as stated in the Acquire Image topic, use the following methods and properties to recognize the barcode.

Methods

Method Description
Analyze(Object) Detects barcodes on the given object.
Analyze(Bitmap) Detects barcodes within the given bitmap image.
Analyze(IntPtr) Detects barcodes within the given handle to a DIB (Device Independent Bitmap).

Properties

Property Description
AdditionalReadingPass Gets and sets a value which determines if an additional processing pass will be performed on a scaled (reduced) version of the original image.
AppendCheckSum Gets and sets a value which determines if a checksum value is appended to the barcode during recognition.
Area Gets and sets the area of the image, in pixels, to analyze for barcode recognition.
AustralianPostCustomDecodeMode Gets and sets the AustrailianPostCustomDecodeType.
BarcodeTypes Gets and sets the type of barcodes to analyze during recognition processing.
IncludeControlCharacters Gets and sets the control characters in the barcode value during recognition processing.
InkColor Gets and sets the ink color of barcodes to search for during recognition processing.
MaximumBarcodes Gets and sets the maximum number of barcodes to recognize.
Orientation Gets and sets the orientation of the barcodes to analyze during recognition.
ReturnPossibleBarcodes Gets and sets a value to determine if possible barcodes are returned in the result list.
GrayscaleProcessing Property Gets and sets a value which determines if grayscale processing will be performed on images that are 8bpp or 24bpp.

 

C# - Minimum C# code to recognize barcodes in an image using Accusoft.BarcodeXpress.Net

using (BarcodeXpress barcodeXpress = new BarcodeXpress("."))
using (Bitmap bitmap = new Bitmap("image.bmp"))
{
    // The SetSolutionName and SetSolutionKey methods must be called to distribute the runtime.
    barcodeXpress.Licensing.SetSolutionName("YourSolutionName");
    barcodeXpress.Licensing.SetSolutionKey(12345,12345,12345,12345);
    // The SetOEMLicenseKey is required if Manually Reported Runtime Licensing is used.
    barcodeXpress.Licensing.SetOEMLicenseKey("1.0.AStringForOEMLicensing");

    // call Analyze to detect barcodes in the image
    // all detected barcodes will be returned to the
    // Result object array. 
    Result[] results = barcodeXpress.reader.Analyze(bitmap);

             // get some results info, if any
    for (short i = 0; i < results.Length; i++)
    {
        // get result for current barcode
        Result curResult = (Result)results.GetValue(i);

                 // do something with results
        MessageBox.Show(curResult.BarcodeName);
        MessageBox.Show(curResult.BarcodeValue);
    }
}

See the Barcode Xpress Overview topic for code examples on recognizing barcodes.

See the Acquire an Image for Barcode Recognition for more code examples.

To obtain the results after analyzing the barcode on an image, see the Access Results topic.

See Also

Acquire an Image for Barcode Recognition

Access Results

Create a Barcode

Debug Your Application

Overview

Is this page helpful?
Yes No
Thanks for your feedback.