# J4L Barcode Vision for REALbasic

Copyright J4L (http://www.java4less.com) 2013

- J4L Barcode Vision 1D
  - Introduction
  - Demo/Evaluation version
  - Installation of the registered version
  - How to use the classes
- J4L QRCode Vision
  - In troduction
  - Demo/Evaluation version
  - Installation of the registered version
  - How to use the classes

##
J4L Barcode Vision 1D

## Installation

J4L Barcode Vision for Realbasic is set of REALbasic classes which can read (scan) barcodes images. It supports the following features:

- Finding all barcodes in large images (for example in a scanned page or document)
- Barcodes can have any orientation (vertical, horizontal, rotated)
- Supported barcode symbologies are: EAN13, EAN8, CODE128/EAN128, CODE39 (and extended) , INTERLEAVED 25, IDENTCODE, UPCA , UPCE .... (more can be devoloped on demand).

Know limitations are:

- Best result are achieved with black barcodes on white background.
- Shadowed or blurred barcodes can be unreadable.
- Bars should not "touch" each other nor the text below the barcode.

## Demo/Evaluation version

The evaluation version contains a executable file (VisionDemo* where * is the platform suffix) which demonstrates the scanning process. It will scan all BMP, GIF, PNG and JPG files located in the images subdirectory.

Run VisionDemo* and click on the scan button to test the demo version.

##

## Installation of the registered version

The delivered file component/vision.rbp , is the complete example application for RealStudio, in order to use the recognition software in your own application you have to import all the classes in your own application except App, Window1 and MenuBar1

## How to use the classes

The use of the component is very simple. You must follow these steps:

1. Define these variables
   Dim tempFolder as FolderItem // directory of the images
   Dim f as FolderItem // image
   Dim br as J4LBarcode1DReader // barcode reader
   dim data() as J4LBarcodeData // list of barcodes in the image
   Dim img as J4LImage
   Dim pic as Picture
   Dim d1 as J4LBarcodeData
2. Load for an image:
   tempFolder as new FolderItem("images") // this will be the directory where the images are
   f = tempFolder.Child( "ean8.png" )
   pic=Picture.Open(f)
3. Create a J4LImage object:
   img=new J4LImage()
   img.initFromImage(pic)
4. Create a J4LBarcode1DReader instance:
   br = new J4LBarcode1DReader
5. Set the symbologies you expect to find in the image:
   // we will be looking for EAN 8 and code 39 barcodes
   br.symbologies= int32(J4LBarcode1DReader.tType.EAN8) or int32(J4LBarcode1DReader.tType.CODE39)
6. Call the scan() method of the J4LBarcode1DReader
   data=br.scan(img,true)
   the second parameter tells the class to return also information about barcode candidates, these are objects in the image that could be a barcode but whose recognition was not successful
7. Read the result. The result is a J4LBarcodeData array object. The elements are J4LBarcodeData objects which contain the following information: Symbology (type of barcode), Value ( of the barcode) and position ( x , y). If the barcodeFound property is false it means a barcode candidate was found but not recognized successfully.
   for i=0 to UBound(data)
   d1=data(i)
   if (d1.barcodeFound) then
   s="Barcode found: " + d1.toString()
   end if
   next

You can optimize the scanning process by setting the following properties in the J4LBarcode1DReader object:

- maxArea:=90000. Ignore objects larger than 90000 pixels.

- minArea:=30. Ignore objects smaller than 30 pixels.

- minLength:=15. Ignore bars shorter than 15pixels.

- maxLength:=1000. Ignore bars longer than 1000 pixels.

Depending on the size of the object and the image resolution you use, you can modify these values to speed up the sca nning process.

## J4L QRCode Vision

## Installation

J4L QRCode Vision for Realbasic is set of REALbasic classes which can read (scan) QRCode images. It supports the following features:

- Finding all barcodes in large images (for example in a scanned page or document)
- Barcodes can vertical or horizontal orientation

Know limitations are:

- Best result are achieved with black barcodes on white background.
- Shadowed or blurred barcodes can be unreadable.

## Demo/Evaluation version

The evaluation version contains a executable file (QRVisionDemo* where * is the platform suffix) which demonstrates the scanning process. It will scan all BMP, GIF, PNG and JPG files located in the images subdirectory.

Run QRVisionDemo* and click on the scan button to test the demo version.

##

## Installation of the registered version

The delivered file component/qrvision.rbp , is the complete example application for RealStudio, in order to use the recognition software in your own application you have to import all the classes in your own application except App, Window1 and MenuBar1

## How to use the classes

The use of the component is very simple. You must follow these steps:

1. Define these variables
   Dim tempFolder as FolderItem // directory of the images
   Dim f as FolderItem // image
   Dim br as QRCodeReader // barcode reader
   dim data() as QRCodeData // list of barcodes in the image
   Dim img as J4LImage
   Dim pic as Picture
   Dim d1 as QRCodeData
2. Load for an image:
   tempFolder as new FolderItem("images") // this will be the directory where the images are
   f = tempFolder.Child( "qrcode.bmp" )
   pic=Picture.Open(f)
3. Create a J4LImage object:
   img=new J4LImage()
   img.initFromImage(pic)
4. Create a J4LBarcode1DReader instance:
   br = new QRcodeReader
5. Call the read() method of the QRCodeReader
   data.isBWImage=true ' input image is black and white
   data=br.read(img)
6. Read the result. The result is a QRCodeData array object. The elements are QRCodeData objects which contain the following information: Value ( of the barcode) and position ( x1 , y1 , x2 , y2 , x3 and y3) and the ecLevel of the barcode.
   for i=0 to UBound(data)
   d1=data(i)
   if (d1.decodingSuccessfull) then
   s="Barcode found: " + d1.toString()
   end if
   next