Common Vision Blox 15.0
Barcode

Common Vision Blox-Tool


 C-Style 

 C++ 

 .Net API (C#, VB, F#) 

 Python 
 CVCBarcode.dll    Cvb::Barcode   Stemmer.Cvb.Barcode   cvb.barcode 

Introduction

Image Processing Tool for reading Barcodes

CVB Barcode is a library of functions for decoding one- and two-dimensional barcodes which is used within the Common Vision Blox environment.
It offers a powerful algorithm to accurately decode common barcode symbologies reliably and at high speed.
The algorithm locates the codes automatically within the camera image, irrespective of position or rotation and can even read codes when they have poor contrast, are printed on uneven surfaces, or need to be viewed in a challenging environment or orientation.
CVB Barcode allows the secure and positive identification and tracking of components and products throughout their life cycle based on a wide range of codes.

Supported barcode symbologies:

Two-dimensional barcodes:

  • Data Matrix and Dotted Data Matrix (all sizes, ECC 0, 50, 80 ,100, 140 and ECC 200, rectangular)
  • 2D Pharmacode (all sizes, ECC 0, 50, 80 ,100, 140 and ECC 200, rectangular)
  • PDF 417 (all sizes, PDF 417 truncated, MicroPDF)
  • RSS codes (RSS-14, RSS-14 Truncated, RSS-14 Stacked, RSS-14 Stacked Omnidirectional, RSS Limited)
  • QR codes (Mini-QR and Standard-QR)

One-dimensional barcodes:

  • EAN 13 (possibly with 2 or 5 position add-on codes)
  • EAN 8 (possibly with 2 or 5 position supplementary codes)
  • UPC A ( possibly with 2 or 5 position supplementary codes)
  • UPC E (possibly with 2 or 5 position supplementary codes)
  • Code 128 ( EAN 128)
  • Code 39 (standard, full ASCII)
  • Code 32
  • Code 11
  • Code 93
  • 2/5 interleaved
  • 2/5 discrete
  • SonyCode
  • Pharmacode
  • MSI Plessey
  • Postal codes (Postnet, Planet, USPS, KIX, Australian, Royal Mail)

Not supported barcode symbologies:

ECI Encoding is not supported with CVB Barcode.

Features

  • Supports rectangular AOIs
  • Supports one (selectable) image plane
  • Supports 8 bit per plane
  • Special Barcode features:

    All 1D and 2D barcodes can:

    • activated or deactivated individually,
    • located at any position in the image,
    • be read at any angle of rotation or at different sizes
    • be read when on a curved surface or if they have been optically distorted
    • read when mirrored
    • read when printed black on white or white on black.

    For all barcodes you can:

    • specify the size to be read,
    • deactivate check digit control,
    • deactivate quiet zone control,
    • deactivate the transfer of start and stop codes, if necessary.

    Code grading:

    In addition to pure barcode reading, CVB Barcode also offers verification (grading) of 1D-barcodes, Datamatrix and QR-Codes.
    Standardised measurement procedures are used to objectively evaluate the print quality of the code under predefined conditions. This level of quality control is common in industrial environments to ensure the printing of the bar code is of sufficient quality to ensure the elimination of reading errors when tracking the code later in the production process.

    • Data Matrix
    • 2D Pharmacode
    • 1D Barcodes

Demo version and software protection

When you first start the Barcode library, you will be asked to enter a license number for Barcode.
You can obtain this from STEMMER Imaging.

To test the library, select Cancel to close the entry form.  This automatically starts the demo version of Barcode.
From time to time you will be asked to enter your license number and Evaluation Mode hint is displayed.
In addition, the following substitutions will be made in all decoded Barcodes within the Demo version:

  • e -> x
  • E -> X
  • 0 -> 5

Apart from these restrictions, the demo version is in every respect identical to the licensed version.

Theory of Operation

Barcodes encode information by means of a pattern consisting of light and dark structures.
Classical one-dimensional barcodes consist of dark lines of differing widths separated by bright gaps of constant or variable width.

The figure below illustrates the principle of this structure:

The width of the narrowest line or the narrowest gap is known as the module width and is assigned the letter X.
The width of the other lines and gaps are specified as multiples of this module width.
The unit millimeter or mil is used as the unit of measurement for the module width, where:

1 mil = 1/1000 inch = 0.0254 mm

Commonly used barcodes have module widths of 6.7 to 40 mil (0.17 mm to 1 mm).
Before the first or after the last line in the barcode there is a bright quiet zone. This is usually at least 10 module widths in size.

The height depends on the type of application. The basic rule is: the higher the barcode, the easier it is to decode.

There is a whole range of differing barcode symbologies. Basically these can be subdivided into two-level codes and multi-level codes.
Two-level codes simply consist of two elements of different width (line or gap). Narrow elements have the width X while wide elements are generally 2X and 3X wide.
In the case of multi-level codes, there are four or more different widths which are generally whole multiples of the module width. The internal structure also differs in the different symbologies. However, the principle is very similar for most symbologies.

The standards DIN/EN 796 to DIN/EN 801 determine the precise specifications of barcodes in Germany and Europe.

Barcode structure using the example of Code 39

In the following, we explain the structure of barcodes using the example of Code 39.
Code 39 is a two-level code. Here the wide elements are 2.5 times as wide as the narrow elements. In Code 39, there is a gap between the characters.
In some other symbologies, this gap is not needed since in these a character ends with a gap, not with a line.

The illustration below presents a Code 39, which contains the data digits 1234 The code also contains a check digit.

The code consists of the following components, listed from left to right:

  • the left-hand quiet zone,
  • the start digit *,
  • the four data digits 1234,
  • the check digit A,
  • the stop digit * and
  • the right-hand quiet zone.

This structure – quiet zone, start digit, data digits, check digit if necessary, stop digit and quiet zone - is typical of almost all 1D barcodes.

The start and stop digits are used to differentiate between the different symbologies. They are thus different for each symbology. In many symbologies, such as Codebar, the start and stop digits contain additional data information; in others, such as Code 39, they are always the same. In some symbologies, such as EAN, no start or stop codes are depicted.

The data digits are sequenced from the symbology's character set. This character set differs from symbology to symbology. Some define digits only, others digits and a number of special characters while others, such as Code 39, define alphanumeric characters or the entire ASCII character set.
Each data digit does not necessarily always correspond to a specific sequence of lines and gaps. Many symbologies combine characters or append additional control digits. For the purposes of differentiation, the designation code word is used for a given sequence of lines and gaps. The way in which data digits are then translated into code words and how code words are then interpreted as data digits depends on the symbology. This process is clarified in an example below.

The check digit is a further character from the symbology's character set. A special procedure is applied to calculate it from the data digits and it is then appended to these. When the barcode is decoded, this character can be regenerated from the data digits and compared with the appended check digit. If a variance is detected, the barcode has not been read correctly and rejected as "not recognized": This procedure makes the reading of barcodes considerably more reliable.
Check digits are not specified in all symbologies. In many they are optional and in many there is more than one procedure for the calculation of check digits.

If a barcode cannot be read even it is of a good quality, the first thing to do is to deactivate internal checking and instead check the transferred check digit manually.

Hints on using Barcode

To achieve maximum speed of evaluation, you should:

  • Activate only those symbologies which are really required.
  • Restrict the size of the barcodes to the minimum required using the min_digits and max_digits parameters.
  • Deactivate all unnecessary options.

To achieve maximum read reliability, you should:

  • Activate only those symbologies which are really required.
  • Activate checking for the presence of quiet zones by means of the parameter quiet_zone.
  • Activate the examination of the check digit using the checkdigit parameter.
  • Restrict the size of the permitted barcode to the minimum necessary using the min_digits and max_digits parameters.

If a barcode is not read, check the following:

  • Is the symbology supported by Barcode?
  • Is the check digit test activated even though no check digit was defined when the barcode was created?
  • Was a different check digit calculation procedure used when creating the barcode? If in doubt, deactivate the check digit test.
  • Might the quiet zones be too narrow? If in doubt, deactivate the quiet zone test.
  • Is the module width large enough?
    In the case of omnidirectional acquisition the module width of the barcode should be greater than 3 pixels and in the case of axially aligned barcodes (rotation < 10°) larger than 2 pixels.
    In the case of Data Matrix, cells should be larger than 4 x 4 pixels.
  • Is the image definition adequate? Depiction of bright-dark transition < 4 pixels (with a maximum resolution of < 2 pixels)
  • Is the contrast ratio sufficient? Barcode contrast ratio at least 50 %?
  • Is the barcode uniformly illuminated?

Memory requirements:

  • data segment: approx. 60 Kbytes
  • heap: approx. 140 Kbytes
  • stack: approx. 12 Kbytes

Readout Modes

Matching barcodes consists of several steps, of which the first one is scanning the image for the occurence and position of barcode patterns.
This scanning can be imagined like a search along a number of particularly arranged lines drawn over the image.

The arrangement and number of profile lines can be configured by setting the Readout Mode.
The selected CVC_BC_DIRECTION determines the parameters affecting the readout stage:

CVC_BC_OMNI Angles and stripes (Number of equiangular rotations of an absolute number of equidistant parallels)
CVC_BC_FENCE Range only (distance in pixels between horizontal profiles)
CVC_BC_LADDER Range only (distance in pixels between vertical profiles)
CVC_BC_BOTH Range only (distance of both horizontal and vertical profiles)
CVC_BC_SMALL_CODES Special BC_DIRECTION mode, no readout parameters valid

The speed of barcode recognition can be increased by reducing these search profiles, ie. the number of search operations, to the minimum of necessary steps.
If, for example, the orientation of the barcodes is well known and consistent, the complexity and thus the overall processing time of the reading step decreases.

Effect of library settings on the read result

The example below illustrates the effect of the library settings on the result of the read operation.
The following Code 39 with check digit is to be read:

This code is an extended Code 39, i. e. certain character combinations stand for other characters.
Thus +A stands for the character a which is not defined in the normal Code 39. This code therefore actually contains ab plus a check digit.
The library defines the function CvcBcSetCode39() which determines the read parameters for Code 39.
These include the following parameters:

min_digits minimum number of Code 39 code words
max_digits maximum number of Code 39 code words
checkdigit evaluate/ignore check digit
transmit_checkdigit append/do not append check digit to data
transmit_start_stop transmit/do not transmit start and stop digit with data
full_ascii enable/disable complete ASCII code

The min_digits and max_digits parameters are used to restrict the number of code words which are to be read.
The code in the example contains the 5 code words +, A, +, B and H.
Here, the start and stop digits do not count as code words.
For example, by specifying min_digits = 5 and max_digits = 5 it is possible to restrict Code 39 read operations to this size.
How many and which characters the library returns following decoding nevertheless depends on the other settings.
The table below provides an overview of the influence of the settings.

full_ascii checkdigit transmit_checkdigit transmit_start_stop Returned code Number of characters
TRUE TRUE FALSE FALSE ab 2
TRUE TRUE TRUE FALSE abH 3
FALSE TRUE FALSE FALSE +A+B 4
FALSE TRUE TRUE FALSE +A+BH 5
FALSE FALSE FALSE +A+BH 5
FALSE FALSE TRUE *+A+BH* 7

In all these cases the element num_digits from the structure CVC_BC_INFO would have the value 5.

The table contains two settings which return the same code.
The difference is that in the first setting the check digit is evaluated and transmitted while in the second setting the check digit is treated as a normal data digit.

The transmit_start_stop setting depends on all the other settings.

The parameters have a similar significance in all other symbologies.

Information on Barcodes types

One-dimensional barcodes are the classical barcodes which embrace a whole range of different symbologies.
The most important of these are: Code 128, Code 39, Code 93, EAN 13, EAN 8, UPC A, UPC E, 2/5 interleaved, 2/5 discrete.
Others are being prepared.

Two-dimensional barcodes are an extension of the classical one-dimensional barcode.
They have been developed in order to accommodate more information within a limited surface area.

Not supported Barcodes:
ECI Encoding is not supported with CVB Barcode.

1D Barcodes

A variety of barcode symbologies have been developed for different types and sectors of application.
The EAN 8 and EAN 13 code types tend to dominate in the retail sector. In industrial applications, the codes "2 of 5", Code 128, Codabar or Code 39 are frequently encountered.

The following table lists all available 1D codes in CVB Barcode and presents examples and typical areas of application:

Barcode symbology Example Area of application Character set Length Checksum
2 of 5 Interleaved industry numerical variable Modulo 10
2 of 5 Discrete  
Codabar blood database, industry numerical with special characters variable Modulo 16
Code 11 numerical, hyphen
Code 39 industry alphanumerical variable Modulo 43
Code 32 pharmaceutical numerical
Code 93 ASCII incl. space variable Modulo 47
Code 128 industry full ASCII incl. non-printables variable Modulo 103
EAN 8 retail Europe numerical code 8 Modulo 10
EAN13 retail Europe numerical code 13 Modulo 10
Pharmacode numerical
Sonycode   alphanumerical
UPC A retail USA/Canada numerical 12 Modulo 10
UPC E retail USA/Canada numerical 8 Modulo 10
MSI Plessey books, food numerical variable N/A
Planet postal numerical 12
PostNet postall numerical variable Difference to next decade after padding
4-state KIX postal alphanumeric variable
4-state Royal Mail postal alphanumeric with brackets variable weighted
4-state Australian Post postal alphanumeric with space and # variable Reed Solomon
4-state USPS postal 31

1D: SonyCode

Additional descriptions regarding the SonyCode

The SonyCode specification "Attachment III" has been extended with the following definitions.

Regarding point 6: Description of SONY-Barcode (Coding/Decoding)

  • The header (A) at the begin of the code and the end (F) at the end of the code needs to be present.
  • The minimum number of code words ist 4, the maximum number is 32 by definition.
  • The code may or may not have a checksum. The checksum - if present - consists of 2 words and is always located directly before the end (F) of the code. Whether the checksum will be used or not has to be determined with the parameter checksum of the CvcBcSetSonyCode structure.
  • If the parameter code_interpretation is active the following definitions also hold:
  • The word for the beginning (A) may only be on the beginning of the code and the word for the end (F) only at the end of the code and must not appear again inside the code.
  • The radiuscode may or may not be available. It can be located on any position of the code.
    If the radiuscode appears several times, the last one is passed to the infostructure.
    The radiuscode is only interpreted when the element code_interpretation is active.
  • If the radiuscode is not followed by the stop digit (F), the checksum or a letter, the radiuscode has to be coded as a 3-digit number.
    Through this definition the code is non-ambiguous and a misinterpretation is avoided.
    If this definition is disregarded it may be impossible to detect a misinterpretation and therefore the respective error CVC_BC_DATA_FORMAT_ERROR may not be passed on to the user.
  • The beginning of the radiuscode (E) is indicated by the sign #.
  • If the code contains digits or words which dont correspond to the definitions, the decoding is stopped and the error CVC_BC_DATA_FORMAT_ERROR will be returned.
    Possible reasons for such an error are:
    • The beginning (E) of the radiuscode contains of less the 2 numbers
    • two subsequent letters (not valid for the beginning e.g. AC3...)
    • D7 to D9 are not defined
    • product ID key 8-9 not defined

See the descriptions of the elements of the infostructure.

1D: Pharmacode

The Standard and Miniature one-track Pharmacode, originally established by the company Laetus, is one of the oldest stripe codes still in use.
It differs from other 1D codes in that it specifies the widths and heights of a code's component in absolute measures and that it allows for a fairly generous range of values (see table below).
Also, there are no consistency markers like those used by e.g. EAN codes defined for a Pharmacode.
Because of these peculiarities it is essential to define the code reading parameters accurately, which often makes reading Pharmacodes challenging.

The dimensions of 1D Pharmacodes are defined as follows:

Standard one-track Pharmacode:

  Minimum Standard Maximum
a 0.4 mm 0.5 mm 0.7 mm
b 1.3 mm 1.5 mm 2.5 mm
c 0.9 mm 1.0 mm 2.5 mm
d 1.2 mm 1.5 mm 2.5 mm
e undefined 8.0 mm undefined
z 1.3 mm 1.5 mm 2.5 mm
b/a   3  

Miniature one-track Pharmacode:

  Minimum Standard Maximum
a 0.30 mm 0.35 mm 0.45 mm
b 0.90 mm 1.00 mm 1.50 mm
c 0.55 mm 0.65 mm 1.65 mm
d 0.80 mm 1.00 mm 1.70 mm
e undefined 6.00 mm undefined
z 0.90 mm 1.00 mm 1.70 mm
b/a   3  

Recommendations and Information

In order to read a Pharmacode successfully, it is essential to use appropriate settings in the CVC_BC_CONFIG structure:

  • Pharmacodes should always be read 'alone' - please deactivate all other code types in a configuration for Pharmacode reading!
  • It is impossible to read a Pharmacode omnidirectional because e.g. left-to-right and right-to-left orientations are indistinguishable. Therefore, it is also necessary to explicitly define the orientation of the code (a Pharmacode may be read in either direction, but will yield different results depending on the reading direction!).
  • The area of interest for code reading should not contain anything else but the code and a reasonably sized quiet zone (typically about 5 mm). Additional structures may lead to misreadings, as the Pharmacode has no means of validating a result.
  • Because the size of the Pharmacode elements is defined in absolute metric units, it is necessary to know how the camera resolution maps to the real world.
    This registration needs to be specified through the pixel_reference parameter of the CvcBcSetPharmacode function: This parameter defines how many 1/10 pixels there are to one millimeter.
    Example: Suppose you have the picture of a Pharmacode where the broad bars are roughly 12 pixels wide. From the table above we know that the Pharmacode definition requires the wider bars to be 1.5 mm wide, so these 12 pixels should map to 1.5 mm and therefore the pixel reference is 80 (12 pixels/mm / 1.5 mm * 10).
  • As an alternative to the pixel_reference setting, switching between Standard and Miniature size can be achieved through the scale_factor parameter of CvcBcSetPharmacode.

Example

For testing it is recommended to use one of the Barcode Control Tutorials because they provide direct access to all the relevant parameters through the Barcode OCX's property page.
As described previously a matching configuration is an essential precondition.

  • The run_direction (orientation of the code) has to be set: e.g. from right to left (setting the orientiation is crucial - the Pharmacode is readable in both directions, but usually with very different results depending on read direction).
  • The pixelreference is according to the reproduction scale in 1/10 pixel per millimeter.
  • The scale_factor of the Pharmacode has default value 100%  but must be set for  Miniature-Pharmacodes  to 66% (or other vales if used).
  • The treshold value has to be set for colored Pharmacodes digitalisation to define the value for bar acceptance in the range from 0 to 100.
  • For min_digits and max_digits the real bar count values should be used.
  • The minimum quietzone value in 10th of a millimeter value is to be configured.

1D: Postal codes

General notes

Since the library tries to read all supported postal codes at once, all codes share a number of common parameters. It is however also possible to configure each type individually.
As a side effect, the latter can lead to failed reads if more than one type is active at a time.

To prevent this, the following parameters should be identical for all postal codes: threshold, invert, mirror and quiet zone. This is also the default configuration.
The direction parameter is CVC_BC_FENCE by default.

When a more differentiated configuration is desired, the following chain of analysis should be considered:

PostNet > Planet > 4-state USPS > 4-state KIX > 4-state Royal Mail > 4-state Australia

PostNet, Planet and 4-state USPS (Intelligent Mail)

The POSTNET (POSTal Numeric Encoding Technique) code was developed by the U.S. Postal Service to encode information on postal codes.
The PLANET (Postal Alpha Numeric Encoding Technique) code is used to identify and track pieces of mail during delivery.

The barcode symbology of the PLANET code is inverse to the POSTNET code. Every POSTNET code word is a combination of two full-height and three half-height bars whereas every PLANET code word uses three full-height and two half-height bars. Both codes always start and end with a full "start/stop bar".

For Postnet- and Planet codes following restrictions apply:

  • Both codes use the same search technique. If both codes should be read simultaneously while activating DecodeBarcode, the values of the parameters direction, threshold, inverse, mirror and quietzone must be identical for both, Postnet- and Planet code.
    When there are differences, the parameter of Postnet code is being used. If different parameters are required, it is necessary to do the evaluation by activating DecodeBarcode two times in succession.
  • For both codes a maximum width of 15 pixels per bar and 40 pixels per space is valid. When using higher resolutions, the image needs to be scaled down accordingly.

The successor of both codes is the "OneCode 4-State Customer Barcode" (4-state USPS in CVB Barcode), which combines the capabilities of PostNet and Planet. It combines ZIP code and tracking data in one barcode symbol.

4-state Royal Mail (RM4SCC with option for Singapore)

This is the barcode symbology the British Royal Mail is using for machine readable UK postcodes and Delivery Points. It is also referred to as CBC (Customer Bar Code) in the documents provided by the Royal Mail.

4-state KIX

KIX (Klant index) is the Dutch equivalent to RM4SCC, with a slight difference in the character set. It can be used to encode a complete address.

4-state Australian Postal

The Australian postcode is currently the most elaborated one. It covers all common postal usage patterns, encoding them in a so-called Format Control Code (FCC).

2D Barcodes

Initially developers interleaved one-dimensional barcodes. This resulted in the so-called stacked barcodes which were able to integrate a lot more information on a comparable surface area.

The most elaborate stacked barcode is the PDF 417. Apart from its high information density, this symbology also permits error correction, meaning that partially destroyed barcodes can still be read.

Matrix codes represent a different type of development. They depart totally from the classic barcode concept and present the information in the form of rectangular matrices with black and white areas. In this way, they achieve an even higher information density, but they cannot be read with laser-based read systems. A typical example of matrix codes is the Data Matrix.

A 2D barcode can accommodate significantly more information than the familiar standard barcodes on a comparable area. They also permit the coding of alphanumeric characters and binary data, offering the possibility to store an actual description of the recorded object (e.g. name or identifier). The figures below compare a Code128 and a PDF417 barcode using the same resolution and a comparable surface area. The PDF417 is able to store the same numerical combination 13 times.

In addition, 2D barcodes can offer a very high level of reliability. A Reed-Solomon code with up to 9 reliability levels was implemented in the development of the PDF417. For this reason, the code can still be evaluated correctly even if it is damaged or partly illegible.

2D barcodes are widely used in all kinds of applications. They are particularly interesting for fields like medical engineering, the electronics industry and in post and package routing.

2D barcodes can be distinguished into 3 groups:

  1. Stacked codes
  2. Composite codes (combination of linear and stacked codes)
  3. Matrix codes

Examples of stacked 1D barcodes

Codablock

  • Codablock consists of stacked standard barcodes. The preferred version is currently Codablock F which consists of Code 128.
  • 2-44 rows with 4-64 data digits plus 5 control digits
  • 10-150 letters or 20-300 digits

PDF 417

  • 3-90 rows with 1-30 data digits plus 4 control digits
  • typical height-to-width ratios: 1:1 to 1:4
  • 2500 digits, 1600 alphanumerical characters or 950 bytes of binary data.

Micro PDF 417

Micro PDF 417 is similar to standard PDF 417 except for the size, which provides improved area efficiency.

  • 4 to 44 rows
  • 1 to 4 columns
  • 366 digits, 250 alphanumeric characters or 150 bytes of binary data
  • Default readout direction: CVC_BC_BOTH

Examples of composite codes

RSS (Reduced Space Symbology)

  • RSS is a high density 1D bar code designed to encode standard UCC/EAN item numbers - up to 14 digits - in a very small footprint
  • Several variants of RSS exist, including Stacked, Limited and Expanded, the latter having the ability to encode additional data beyond the basic UCC/EAN Item Number
RSS-14 Stacked RSS-14 Stacked Omnidirectional
  • Any member of the RSS family can be printed as a stand-alone linear symbol or as a composite symbol with an accompanying 2D Composite Component printed directly above the RSS linear component
RSS-14 Truncated with CC-A RSS Limited with CC-B

Examples of matrix codes

2D Pharmacode

  • Square symbol
  • Square module in square grid
  • Lateral L as search pattern
  • 9*9 to 49*49 modules (ECC 000 - 140),  10*10 to 144*144 modules (ECC 200)
  • Up to 3114 numerical characters, 2335 text characters or 1556 bytes
  • Up to 8 color bars distributed around the code

Additional information can be found in chapter 2D Pharmacode.

Data Matrix

  • Square symbol
  • Square module in square grid
  • Lateral L as search pattern
  • 9*9 to 49*49 modules (ECC 000 - 140),  10*10 to 144*144 modules (ECC 200)
  • Up to 3114 numerical characters, 2335 text characters or 1556 bytes
  • Sequencing up to 16 codes possible

QR Code

  • Square symbol
  • Square module in square grid
  • Square bull's-eye in three corners as the search pattern
  • 21*21 to 105*105 modules
  • Up to 2509 numerical characters, 1520 text characters or 1045 bytes

Like other matrix codes, the QR code requires a minimum module size of 5 pixels. The module size should ideally be at least 7 pixels for optimum reading results.

2D: Pharmacode

The 2D Pharmacode is described with the other 2D barcodes. Here are some more information and recommendations.

Recommendations and information

The option 2D Pharmacode makes only sense for codes which have bars (color or grey value bars) around the code.
Please activate the bars which are present.
Please choose a threshold for the bars in % (sometimes the image is monochrome and therefore the bars also. In other cases it is a color image and the bars have different colors.)

Please take care that the Barcode Tool is working only on single planes! Please choose a plane a check there the values of your thresholds.

Examples

For testing this it is recommended to use one of the Barcode Control Tutorials (Barcode OCX Tutorial) because you have direct access to all the Barcode parameters via the Property Page:

Code Grading

The 1D Code Grading in CVC Barcode is based on Norm ICO/IEC 15416.

The 2D Code Grading in CVC Barcode is related to the relevant norms as listed below:

graded

grading optional
  Norm CVB
Parameter IEC 16022 IEC 15415 AS 9132 Barcode
Decode

 

Symbol Contrast

 

Fixed Pattern Damage  

   
Axial Nonuniformity

 

Grid Nonuniformity

 

Unused Error Correction

 

Print Growth

 

Modulation

 
Additional Reflectance

 
Angle of Distortion (Skew)  

Dot Size

Dot Center Offset

Barcode API

Barcode Library

Barcode contains functionality for decoding one and two-dimensional barcodes within the Common Vision Blox environment.
It works with Common Vision image objects (of type IMG) with 8 bit image depths.
The image objects can contain multiple planes.

The core function for barcode decoding is CvcBcDecodeBarcode(). It is solely responsible for reading barcodes.
The simplest way to call CvcBcDecodeBarcode() is:

char code[CVC_BC_MAX_NUM_CODECHAR];
CvcBcDecodeBarcode(image, 0, NULL,0, NULL, code, sizeof(code), NULL);

The function searches plane 0 of the image Image in any barcode in any direction and then decodes it.
Following the call, the code field contains the decoded information which is terminated with the null character.
In addition the function returns the number of characters read as the result of the function or returns the value null if no barcode was found.

All the other library functions are used to influence which barcodes are read and the conditions which are to apply.
This is achieved by so-called configurations.  Multiple configurations may exist in parallel.

Barcode Control

The Barcode Control is a tool which makes it possible to read in barcodes.
It is an Control which can be easily incorporated in a variety of visual development environment.

After you have linked the Barcode Control into your project, a Barcode object can be added to your application using the icon below.
The control is based on the Barcode library and encapsulates its range of functions.
As a result, more detailed information can be found in the documentation for Barcode library.

The Barcode Control allows you to decode a large number of different types of barcodes.
It is very flexible in terms of orientation, size and distortion of barcodes.
A better level of performance can be achieved by optimizing recognition based on individual needs.

Example Applications

There are several Example programs as source codes and executables in different current compilers under \cvb\Tutorial\Barcode directory for the

  • Barcode library and the
  • Barcode Control.

All barcode applications can be tested without barcode license, there will be an evaluation mode label in the display and in some cases result substitution only.

Dotted Data Matrix

This VCBarcode demo program is a demonstration program for the barcode library.
The algorithm locates the codes automatically within the camera image, irrespective of position or rotation and can even read codes when they have poor contrast, are printed on uneven surfaces, or need to be viewed in a challenging environment or orientation.

VCBarcode

Once started, you can use Open Image to load

  • an image file or
  • a Common Vision Blox driver (*.vin) for a camera or a framegrabber.
    If you load a driver then use grab to acquire live images or snap to get a single image. Grab and Snap will automatically read the barcode.
    The file must have an 8 bit image depth and be uncompressed.

You can use the Read Barcode button to decode a barcode in the loaded image. The processing time for every decoding is shown.
To speed up the processing time be sure that you activate only the types of barcodes you expect.
See also Hints on using Barcode.

You can use the Save Config Buttons to write the current settings to a file or use Open Config to read the current settings from a file.