Eym Barcode Reader ActiveX Control FAQ

(Last updated August 3, 2007)

If this FAQ doesn’t answer your question, you may email me directly at eric@metois.com and I’ll do my best to answer in a timely manner.

FUNCTIONALITY

What does it do?

Can it read more then one barcode per image?

What are the resolution and focus requirements for the captured image?

Can this OCX read 2D Barcodes?

What are the currently supported barcode standards?

What’s the difference between a symbology and an encoding system?

Where can I find more information about barcode standards?

TECHNICAL SUPPORT

How do I install this SDK?

How do I use this OCX in VB6?

How do I use this OCX in VB.Net?

How do I use this OCX in Delphi?

How do I use this OCX in C#?

How do I read a barcode from an image file?

All I need is a command line executable. How do I make one?

PRICING AND LICENSING

What’s this design-time versus run-time business?

Do I need to purchase run-time licenses to distribute my application?

 

FUNCTIONALITY

What does it do?

EymBarcodeReader.ocx is an ActiveX control performs all necessary image processing and decoding stages to locate and read a variety of standard 1D barcodes from a bitmap. You may integrate it within your own application in a development environment such as Visual Basic, where you can freely decide that the source of these bitmaps should be (e.g image files or live video captures) and what you may use the decoded barcode data for.

Before attempting to decode a barcode image, the EymBarcodeReader control performs some image processing that aims to go beyond the potentially crude resolution of the provided image. This stage is key to the control’s ability to read barcodes from images that are casually captured from a webcam. Still, the image should be reasonably focused on the object.

The result from the reading process (barcode symbology, code type, location, descriptor, raw  and formatted data) are returned to the calling application as properties of the OCX.

Can it read more then one barcode per image?

Yes. This is a functionality that was added in version 2.0 of the OCX. The control now offers two modes of operations: a “fast” mode and a “Thorough” mode. When the OCX is configured to its “Thorough” mode it examines the provided image around all areas that seem likely to convey a barcode and returns as many barcodes as it could find.

What are the resolution and focus requirements for the captured image?

The image processing algorithms implemented in the EymBarcodeReader control can cope with a surprisingly low image quality. For instance, the free demonstration application can read barcodes from a consumer grade webcam running at 320x240 resolution, provided that it was casually refocused (manually twisting its lens counter-clockwise) so that it can reasonably focus on objects that are placed only a few inches away from it.

The successful reading rate will obviously be affected by the image quality but no scientific analysis was performed along those lines. Instead, you may judge for yourself by taking a peak at a few sample captures that are successfully read by the OCX. As you will see, the resolution and focus of these captures are far from perfect.

Can this OCX read 2D Barcodes?

No. The current version of this control is limited to 1D symbologies only.

What are the currently supported barcode standards?

The following table shows all the symbologies and encoding schemes that are currently supported by the EymBarcodeReader control.

 

Standard

Type

Description

EAN-13

Symbology

Used with consumer products internationally, it conveys 13 decimal digits. The code consists of a 2 to 3 digit number system that identifies a numbering authority, a manufacturer and product code, and a single check digit. The EymBarcodeReader control is aware of 89 different numbering authorities, which it will return in human readable form in its DataDescriptor property.

UPC-A

EAN-13 subset

Used in consumer products in the US and Canada. These are EAN-13 codes with number systems start with “0”. The EymBarcodeReader control is further aware of few UPC-A sub formats including UPC coupons.

JAN-13

EAN-13 subset

Used in consumer products in Japan.

ISSN

EAN-13 subset

International Standard Serial Number for periodical.

ISBN a.k.a. Bookland

EAN-13 subset

International Standard Book Numbering. The EymBarcodeReader control is further aware of the specific formatting of these numbers.

ISMN

EAN-13 subset

International Standard Music Number. The EymBarcodeReader control is further aware of the specific formatting of these numbers.

EAN-8

Symbology

Short version of the EAN-13 symbology, it conveys 8 decimal digits including a check digit.

UPC-E

Symbology

Short version of the UPC-A symbology, it conveys 8 digits including a check digit. Its data is a compressed from of a full UPC-A code. The EymBarcodeReader control will decompress that data and provide it as a standard UPC-A product identification code in its Data property.

Code 128

Symbology

High density and variable length symbology that includes a check digit. This symbology is capable of conveying a large set of characters and used extensively worldwide.

UCC/

EAN128

Encoding system

This encoding system lives on top of the Code 128 symbology. This standard is used to convey a wide range of common data including package dimensions, weights, expiration dates, coupons and more. The EymBarcodeReader control is aware of 91 different application identifiers, for which it will provide human readable descriptions in its DataDescriptor property and format its Data property appropriately.

Code 39

Symbology

Variable length alpha-numeric symbology with no enforced check digit.

Vehicle Identification Number

Encoding system

This encoding system lives on top of the Code 39 symbology. It consists of 17 alphanumerical characters that convey the manufacturer’s identification (WMI), a descriptor of the vehicle’s configuration (VDS), a check digit, the year it was built, the manufacturer’s plant identification and the vehicle’s serial number.

Code 93

Symbology

Higher density variant of Code 39. This code always includes a check digit.

Interleaved 2 of 5

Symbology

Variable length decimal symbology with no enforced check digit.

UPC 2-digit  supplemental

Symbology

Conveys 2 additional decimal digits following an EAN-13, EAN-8, UPC-A or UPC-E barcode. This information is typically intended to identify the issue number of the product.

UPC 5-digit  supplemental

Symbology

Conveys 5 additional decimal digits following an EAN-13, EAN-8, UPC-A or UPC-E barcode. This information is typically intended to convey pricing information. The EymBarcodeReader control is aware of 10 different currency codes.

Codabar

Symbology

Variable length symbology with no enforced check digit. It may encode 16 different characters, plus an additional 4 start/stop characters. This symbology is used by U.S. blood banks, photo labs, and on FedEx airbills.

Patch Codes

Symbology

Set of 6 distinct barcode patterns (1, 2, 3, 4, 6 and T) that are typically used as document separators.

What’s the difference between a symbology and an encoding system?

Some barcode standards are actual symbologies (i.e. means to encode data graphically) while some others are encoding systems that live on top of symbologies.

Where can I find more information about barcode standards?

Further details about these standards was graciously made available online at these sites:

VIS’ Barcode Island - http://www.barcodeisland.com/

Russ Adam’s Barcode1 - http://www.adams1.com/pub/russadam/barcode1.html

TECHNICAL SUPPORT

How do I install this SDK?

When you purchase the SDK through ShareIt you will be given a download link to a 1.9 MB zip file and a license key.

Once you’ve downloaded the SDK, unzip it and run the included Setup.exe to launch the installer. You will be asked for your license key during the installation process. Simply copy and paste the key you received and you will be all set.

How do I use this OCX in VB6?

Before you may use the EymBarcodeReader ActiveX control in your VB project, you must add it to your project using the Components dialog available from the Project menu. The control will subsequently appear in your project’s toolbox window. For there, you’ll be able to add it to a form like any other insertable control.

In your code, you may then configure the core of the EymBarcodeReader, pass image data and retrieve decode results using the object’s various properties.

For example, passing image data contained in a picture box to the OCX would look something like that:

 

EymBCrd.Picture = Picture1.Image

Querying the number of found codes and displaying the data payload of the first code that was decoded into a label would simply amount to the following:

 

If EymBCrd.NbCodesFound > 0 Then

Label1.Caption = EymBCrd.Data(1)

                End If

The SDK is delivered with a fully functional sample VB6 project that illustrates its use.

How do I use this OCX in VB.Net?

You can use the EymBarcodeReader OCX from within Visual Basic .Net using COM Interoperability. As VB.Net imports the OCX, it will wrap it up in a couple of interoperable DLLs. You should then be able to drop an instance of the OCX on a VB form like you would do in VB6. From then on, you should be able to use the object’s various field the same way you would under VB6 with the exception of the Picture input property.

Indeed image handles have evolved from VB6 and VB.Net and in order to pass image data from VB.Net to the EymBarcodeReader OCX, you need to convert the .Net image handle back to an IPictureDisp object

In VB.NET 2003, this conversion can be performed using the VB6.ImageToIPicture() function call:

 

(…)

EymBCrd.Picture = VB6.ImageToIPicture(Picture1.Image)

(…)

In VB.NET 2005, this conversion can be performed using the System.Windows.Forms.AxHost class. This class has a protected method that will convert an Image handle to an IpictureDisp. Because this method is protected, you must derive a subclass of AxHost in order to access it. For example, setting the Picture property of the OCX could look like this:

 

(…)

EymBCrd.Picture = clsIpictDisp.ImgToIpicDisp(Picture1.Image)

(…)

Where clsIpictDisp is a class you define as:

 

Imports System.Windows.Forms

Imports stdole

 

Friend Class clsIpictDisp

    Inherits System.Windows.Forms.AxHost

 

    Public Sub New()

        MyBase.New(Nothing)

    End Sub

 

    Public Shared Function ImgToIpicDisp(ByVal img As Image) As stdole.IPictureDisp

        Return AxHost.GetIPictureDispFromPicture(img)

    End Function

 

    Public Shared Function IpicDispToImg(ByVal pic As Object) As Image

        Return AxHost.GetPictureFromIPicture(pic)

    End Function

End Class

NOTE: With the exception of minor syntactical differences, the same thing can be done with C#

How do I use this OCX in Delphi?

I'm not a Delphi user but I know that people have successfully used the EymBarcode OCX within Delphi projects. The main difficulty is the handling of the OCX's Picture property. A little while ago one of these Delphi users, Olivier Ragheb, was nice enough to send me some Delphi sample code for future reference. I'm including it below and I hope it will be helpful to others. Although he said it was working fine there were still issues for black and white (1 bit per pixel) image files. If you have some of those you might have to convert them to gray scale first.

 

Procedure TfrmBarcodes.ReadBarcodes (bmpIn : TBitmap; intMask : Integer);

// Delphi sample code graciously contributed by Olivier Ragheb

Var IID_IPictureDisp : TGUID;

      PicDesc : tagPICTDESC;

      idispTemp : IPictureDisp;

      intBarcodes, intX : Integer;

Begin

   Try

      With IID_IPictureDisp do Begin

         D1 := $7BF80981; D2 := $BF32; D3 := $101A;

         D4[0] := $8B; D4[1] := $BB;

         D4[2] := $00; D4[3] := $AA;

         D4[4] := $00; D4[5] := $30;

         D4[6] := $0C; D4[7] := $AB;

      End;

 

      With PicDesc do Begin

         cbSizeofstruct := SizeOf(PicDesc);

         picType := 1; // vbPicTypeBitmap

         hbitmap := bmpIn.Handle;

         hpal := bmpIn.Palette;

      End;

 

      If OleCreatePictureIndirect(PicDesc, IID_IPictureDisp, True, idispTemp)=S_OK Then Begin

         BarcodeReader.ThoroughMode := True;

         BarcodeReader.ProtocolMask := intMask;

         BarcodeReader.Picture := idispTemp;

         intBarcodes := BarcodeReader.NbCodesFound;

         If intBarcodes>0 Then For intX := 1 to intBarcodes do Begin

            // Do whatever you want with each barcode

         End;

      End;

   Except End;

end;

How do I use this OCX in C#?

I'm not a C# user but Jose Rouillard was kind enough to contribute the following information on this subject.

We writes: This is a snippet of my C# code (Windows Form that presents the retrieved barcode to the user). It's a non optimize solution: I'm writing a file on the hard disk and then read this file (it could be faster without writing on the disc; I don't know how to do this for the moment).

 

// snippet by Jose Rouillard (Laboratoire LIFL-Trigone - Université des Sciences et Technologies de Lille - France)

 

using System;

using System.Drawing;

using Microsoft.VisualBasic.Compatibility;

using System.Windows.Forms;

using System.IO;

using AxEYMBARCODEREADERLib;

 

// Add reference to "AxInterop.WIA" (Microsoft Windows Image Acquisition Library v2.0) and to AxInterop.EYMBARCODEREADERLib (EYM barocde reader)

 

// Add a Microsoft Windows Image Acquisition to the window Form

// Add a pictureBox to the window Form

// Add a EYM barcode reader to the window Form

 

private void button3_Click(object sender, EventArgs e)

        {

           // Deleting previous file

            File.Delete("capture_webcam.bmp");

           

            // Capturing image from Webcam

            WIA.Item my_item = axVideoPreview1.Device.ExecuteCommand(WIA.CommandID.wiaCommandTakePicture);

            WIA.ImageFile file_for_my_picture = my_item.Transfer(WIA.FormatID.wiaFormatBMP) as WIA.ImageFile;

           

            //writing file on disc

            file_for_my_picture.SaveFile("capture_webcam.bmp");

          

            if (!File.Exists("capture_webcam.bmp"))

            {

                // oops ...

            }

            else

            {

                FileStream photoStream = new FileStream("capture_webcam.bmp", FileMode.Open);                               

                // Passing the picture to pictureBox1               

                pictureBox1.Image = Image.FromStream(photoStream);                

                photoStream.Close();

 

                // Eric Metois EYM job

                axEymBarcodeReader1.Picture = Microsoft.VisualBasic.Compatibility.VB6.Support.ImageToIPicture(pictureBox1.Image);

 

                MessageBox.Show("Nb of barcode : " + axEymBarcodeReader1.NbCodesFound);           

 

                if (axEymBarcodeReader1.NbCodesFound >= 1)

                {

                    label1.Text = "Raw Data:" + axEymBarcodeReader1.get_RawData(1);

                    label2.Text = "Barcode type:" + axEymBarcodeReader1.get_BarcodeType(1);

                    label3.Text = "Symbology :" + axEymBarcodeReader1.get_Symbology(1);

                    label4.Text = "Description:" + axEymBarcodeReader1.get_DataDescriptor(1);

                    label5.Text = "Data:" + axEymBarcodeReader1.get_Data(1);

                    label6.Text = "Confidence :" + axEymBarcodeReader1.get_Confidence(1);

                }

            }

        }

NOTE about Visual Studio 2005:

The sample above illustrates the use of the Microsoft.VisualBasic.Compatibility.VB6.Support.ImageToIPicture() method, which may or may not be part of C# for Visual Studio 2005. As an alternative to this method, you should be able to the System.Windows.Forms.AxHost class. This class has a protected method that will convert an Image handle to an IpictureDisp. Because this method is protected, you must derive a subclass of AxHost in order to access it. With the exception of minor syntactical differences, the C# code should be reminiscent of the VB.NET 2005 snippet shown under How do I use this OCX in VB.Net?

How do I read a barcode from an image file?

Parsing image file formats is outside the expertise of the EymBarcodeReader control. It is left to the calling application to load the file and pass the image data to the control. Fortunately, this is particularly easy in environments such as VB.

For example in VB6, this can be as simple as:

 

(…)

Picture1.Picture = LoadPicture(“BCimg.jpg”)

EymBCrd.Picture = Picture1.Image

(…)

Or even simply:

 

(…)

EymBCrd.Picture = LoadPicture(“BCimg.jpg”)

(…)

In VB.Net, this would turn into:

 

(…)

Picture1.Image = System.Drawing.Image.FromFile(“BCimg.jpg”)

EymBCrd.Picture = VB6.ImageToIPicture(Picture1.Image)

(…)

Or even possibly:

 

(…)

EymBCrd.Picture = VB6.ImageToIPicture(System.Drawing.Image.FromFile(“BCimg.jpg”))

(…)

All I need is a command line executable. How do I make one?

You can easily create a command line executable in VB6. The main form of the application could contain nothing more than the EymBarcodeReader object and the form itself could be set as invisible. In order to capture the command line arguments, use the Command() function call from within VB6. That function returns a string containing all the arguments that were provided as command line.

[As of September 2006] Alternatively, a command line utility is now available to testing and licensing from here.

PRICING AND LICENSING

What’s this design-time versus run-time business?

Using a control from within a development environment (such as VB) is a design-time use. Using the control from a compiled application is a run-time use.

Do I need to purchase run-time licenses to distribute my application?

The purchase of a license key grants you the right to use the SDK on one development machine at any time. Once your project is compiled however, you are granted a limited right to package and distribute the OCX’s runtime as an integral part of your software without requiring that you purchase any further license. These "limitations" are basically there to protect me against software giants or people repackaging my work for a profit. Namely these limitations are as follows:

·          Your product is targeted to end-users (as opposed to OEM integration for example).

·          Your product is not a development tool.  Products that can be used in other products (such as ActiveX controls) are considered to be development tools.

If your application verifies these above conditions, then you are effectively granted a royalty-free runtime distribution (no additional fee required to distribute your project). Otherwise, the integration of the EymBarcodeReader OCX within your application should be subject to further negotiations.