EasyBarCode - Reading Bar Codes¶
A bar code read by the EasyBarCode library.¶
Bar Code Definition¶
A bar code is a 2D pattern of parallel bars and spaces of varying thickness that represents a character string.
These bars and spaces are arranged according to a convention named symbology (see supported symbologies), that specifies the character set and the encoding rules.
Purpose of the EasyBarCode library¶
The EasyBarCode library allows to read bar codes in images:
The reading is fast and robust.
Several codes can be read in the same image.
Many symbologies are supported
The processing can be limited to an
ERegion.NET Python in the image.Specific support is provided for codes arranged in a grid.
The bar codes can be graded according to the
ISO 15416norms.
Note
Using a different set of classes, the EasyBarCode library also supports mail bar codes.
Reading Bar Codes¶
Use the method
EBarCodeReader::Read.NET Python to locate the bar codes asEBarCode.NET Python objects in an image and decode them.This method returns a vector of
EBarCode.NET Python objects for each bar code in the field of view, up to the maximum set withEBarCodeReader::SetMaxNumCodes.NET Python. By default, this maximum is set to 1 to optimize the process in the prevalent single-code cases.
Warning
Be aware that setting MaxNumCodes to a value bigger than the number of codes in big images can make EasyBarCode slow, as it will keep trying to find codes that do not exist in the image.
Each instance contains, among others, the
decoded string.NET Python embedded in the bar code.
Note
The relevant classes of the EasyBarCode library are stored in the namespace EasyBarCode2. Classes outside that namespace (refered to as EasyBarCode1) are an earlier version of the EasyBarCode library, now deprecated.
#include <eVision/EasyBarCode/EasyBarCode2/EBarCodeReader.h>
using namespace eVision;
// Image constructor
EImageBW8 srcImage;
// Bar code reader constructor
EasyBarCode2::EBarCodeReader reader;
// Set the max number of bar codes to find
reader.SetMaxNumCodes(6);
// Read the barcodes in the source image
std::vector<EasyBarCode2::EBarCode> results = reader.Read(srcImage);
// Get decoded string
std::string decodedString = results[0].GetDecodedString();
using eVision;
// Image constructor
EImageBW8 srcImage = new EImageBW8();
// Bar code reader constructor
eVision.EasyBarCode2.EBarCodeReader reader = new eVision.EasyBarCode2.EBarCodeReader();
// Set the max number of bar codes to find
reader.MaxNumCodes = 6;
// Read the bar codes in the source image
eVision.EasyBarCode2.EBarCode[] results = reader.Read(srcImage);
// Get decoded string
string decodedString = results[0].GetDecodedString();
import eVision
from eVision import EasyBarCode2
# Image constructor
srcImage = eVision.EImageBW8()
# Bar code reader constructor
reader = EasyBarCode2.EBarCodeReader()
# Set the max number of bar codes to find
reader.MaxNumCodes = 6
# Read the bar codes in the source image
results = reader.Read(srcImage)
# Get decoded string
decodedString = results[0].GetDecodedString()
Contents¶
How to use the EasyBarCode library.
How to use the EasyBarCode library to read mail bar codes.
How to use the first version of the EasyBarCode library, now deprecated.
Quick Links¶
List of all Classes, Structs and Enumerations of the EasyBarCode library.
Code snippets for the EasyBarCode library.
All the code symbologies read by the text and code reading libraries.
Assess the printing quality of your bar, data matrix and QR codes.
Read bar, data matrix and QR codes using a unified interface.
See also
Some eVision Studio samples illustrate several aspects of the EasyBarCode library:
Barcode reading: Reads bar codes of diverse symbologies in images.Barcode reading PDF417: Reads bar codes of the PDF417 symbology in images.Barcode reading PharmaCode: Reads bar codes of Pharmacode symbology in images.Barcode reading Gs1 DataBar Stacked: Reads bar codes of the Gs1 DataBar Stacked symbology in images.MailBarcode reading: Reads mail bar codes.