RBarcode Vision for Delphi
J4L Barcode Vision for Delphi
Copyright J4L (http://www.java4less.com)
2013
Installation
J4L Barcode Vision for Delphi is
a component which can read (scan) barcodes images. It support 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).
- Support for PDF417 (sold as a
separate product).
- Support for Datamatrix (sold as
a separate product).
- Support for QRCode (sold as
a separate product).
- Support for Aztec Code (sold as
a separate product).
It is available as VCL or Firemonkey
components
The requirements are:
- Any Delphi version starting with
Delphi 4. Also working with most recent versions ( Delphi XE 5).
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.exe) which demonstrates the scanning process. It
will scan all BMP and JPG files located in the *images subdirectories.
Run visionDemo.exe and click one
of the scan buttons to test the demo version.
Installation
of the registered version
The component is delivered in source
code form only. It is made of a set of *.pas files you can compile as component
or include in your application.
Examples
for Vision 1D
The use of the component is very
simple. You must follow these steps:
- Load for example a BMP or JPG
image:
bitMap1 := TBitMap.Create;
bitMap1.LoadFromFile('myimage.bmp' );
// for JPEG
// jpeg := TJPegImage.Create;
// jpeg.LoadFromFile( 'myfile.jpg');
- Create a TJ4LImage object:
image:=TJ4LImage.create(bitMap1);
// or TJ4LImage.create(jpeg);
- Create a TJ4LBarcode1DReader instance:
reader:=TJ4LBarcode1DReader.create();
- Set the symbologies you expect
to find in the image:
// we will be looking for code 128
and code 39 barcodes
reader.setSymbologies(CODE128 + CODE39);
- Call the scan() method of the
TJ4LBarcode1DReader
barcodes:=reader.scan(image);
- Read the result. The result is
a TJ4LBarcodeDataArray object. The elements are TJ4LBarcodeData objects which
contain the following information: Symbology (type of barcode), Value ( of
the barcode) and position ( x , y).
if (length(barcodes)>0) then
for
j:=0 to length(barcodes)-1 do
begin
WriteLn(Output,'Barcode found '+barcodes[j].toString());
barcodes[j].free;
barcodes[j]:=nil;
end
else WriteLn(Output,'No barcode found ');
You can optimize the scanning process
by setting the following properties in the global RVisionConfiguration object:
-
RVisionConfiguration.maxArea:=90000.
Ignore objects larger than 90000 pixels.
-
RVisionConfiguration.minArea:=30.
Ignore objects smaller than 30 pixels.
-
RVisionConfiguration.minLength:=15.
Ignore bars shorter than 15pixels.
-
RVisionConfiguration.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
scanning process.
Examples
for PDF417
The use of the component is:
- Load for example a BMP or JPG
image:
bitMap1 := TBitMap.Create;
bitMap1.LoadFromFile('myimage.bmp' );
// for JPEG
// jpeg := TJPegImage.Create;
// jpeg.LoadFromFile( 'myfile.jpg');
- Create a TJ4LImage object:
image:=TJ4LImage.create(bitMap1);
// or TJ4LImage.create(jpeg);
- Create a TJ4LBarcode1DReader instance:
reader:=TJ4LPDF417Reader.create();
- Call the read() method of the
TJ4LPDF417Reader
barcodes:=reader.read(image);
- Read the result. The result is
a TJ4LPDF417DataArray object. The elements are TJ4LPDF417Data objects which
contain the following information:
- method getValue(): to read the scanned value as an array of integers,
return a TVectorInteger value which is defined as an array of integer.
- methods getX() and getY(): position of the barcode in the
image.
- getConfidence(): 0 means no error has been deteced. A value > 0 means
errors detected and corrected. A value < -1 means errors were not corrected.
- getEClevel(): return maximum number of errors that can be corrected.
- getMacroPDFStringField(f:integer): returns a Macro PDF417 field. The value
for the parameter can be: MACROPDF_SEGMENT, MACROPDF_FILEID, MACROPDF_FILENAME,
MACROPDF_SEGMENT_COUNT, MACROPDF_TIMESTAMP, MACROPDF_SENDER, MACROPDF_ADRESSEE,
MACROPDF_FILESIZE or MACROPDF_CHECKSUM
. These constants are defined
in the J4LPDF417Data unit.
Examples
for Datamatrix
The use of the component is:
- Load for example a BMP or JPG
image:
bitMap1 := TBitMap.Create;
bitMap1.LoadFromFile('myimage.bmp' );
// for JPEG
// jpeg := TJPegImage.Create;
// jpeg.LoadFromFile( 'myfile.jpg');
- Create a TJ4LImage object:
image:=TJ4LImage.create(bitMap1);
// or TJ4LImage.create(jpeg);
- Create a TJ4LDatamatrixReader
instance:
reader:=TJ4LDatamatrixReader.create();
- Call the read() method of the
TJ4LDatamatrixReader
barcodes:=reader.read(image);
- Read the result. The result is
a TJ4LDatamatrixDataArray object. The elements are TJ4LDatamatrixData objects
which contain the following information:
- method getValue(): to read the scanned value as an array of integers,
return a TVectorInteger value which is defined as an array of integer.
- methods getX() and getY(): position of the barcode in the
image.
Examples for
QRCode
The use of the component for QRCode
is:
- Load for example a BMP or JPG
image:
bitMap1 := TBitMap.Create;
bitMap1.LoadFromFile('myimage.bmp' );
// for JPEG
// jpeg := TJPegImage.Create;
// jpeg.LoadFromFile( 'myfile.jpg');
- Create a TJ4LImage object:
image:=TJ4LImage.create(bitMap1);
// or TJ4LImage.create(jpeg);
- Create a TJ4LQRCodeReader
instance:
reader:=TJ4LQRCodeReader.create();
- Call the read() method of the
TJ4LQRCodeReader
barcodes:=reader.read(image);
reader.isBWImage:=false;
// convert image to black
and white
- Read the result. The result is
a TJ4LQRCodeDataArray object. The elements are TJ4LQRCodeData objects
which contain the following information:
- method getValue(): to read the scanned value as an array of integers,
return a TVectorInteger value which is defined as an array of integer.
- method getValueAsString() returns the read value as an string.
- properties x1 and y1: center of the upper left finding pattern
of QRCode.
- properties x2 and y2: center of the upper right finding pattern
of QRCode.
- properties x3 and y3: center of the bottom left finding pattern
of QRCode.
Examples for
Aztec Code
The use of the component for Aztec is:
- Load for example a BMP or JPG
image:
bitMap1 := TBitMap.Create;
bitMap1.LoadFromFile('myimage.bmp' );
// for JPEG
// jpeg := TJPegImage.Create;
// jpeg.LoadFromFile( 'myfile.jpg');
- Create a TJ4LImage object:
image:=TJ4LImage.create(bitMap1);
// or TJ4LImage.create(jpeg);
- Create a TJ4LAztecCodeReader
instance:
reader:=TJ4LAztecCodeReader.create();
- Call the read() method of the
TJ4LAztecCodeReader
barcodes:=reader.read(image);
reader.isBWImage:=false;
// convert image to black
and white
- Read the result. The result is
a TJ4LAztecDataArray object. The elements are TJ4LAztecData objects
which contain the following information:
- method getValue(): to read the scanned value as an array of integers,
return a TVectorInteger value which is defined as an array of integer.
- method getValueAsString() returns the read value as an string.
- properties x1 and y1: center of the the Aztec Code barcode.
|