QualitySettings

QualitySettings

QualitySettings allows to configure recognition quality and speed manually.
You can quickly set up QualitySettings by embedded presets: HighPerformance, NormalQuality,
HighQuality, MaxBarCodes or you can manually configure separate options.
Default value of QualitySettings is NormalQuality.

Constructor

new QualitySettings()

Source:
Examples
//This sample shows how to use QualitySettings with BarCodeReader
let reader = new BarCodeReader("test.png", null,  [ DecodeType.CODE_39, DecodeType.CODE_128 ]);
//set high performance mode
reader.setQualitySettings(QualitySettings.getHighPerformance());
reader.readBarCodes().forEach(function(result, i, results)
{
   console.log("BarCode CodeText: " + result.getCodeText());
});
let reader = new BarCodeReader("test.png", null,  [ DecodeType.CODE_39, DecodeType.CODE_128 ]);
//normal quality mode is set by default
reader.readBarCodes().forEach(function(result, i, results)
{
  console.log("BarCode CodeText: " + result.getCodeText());
});
let reader = new BarCodeReader("test.png", null,  [ DecodeType.CODE_39, DecodeType.CODE_128 ]);
//set high quality mode with low speed recognition
reader.setQualitySettings(QualitySettings.getHighQuality());
reader.readBarCodes().forEach(function(result, i, results)
{
  console.log("BarCode CodeText: " + result.getCodeText());
});
let reader = new BarCodeReader("test.png", null,  [ DecodeType.CODE_39, DecodeType.CODE_128 ]);
//set max barcodes mode, which tries to find all possible barcodes, even incorrect. The slowest recognition mode
reader.setQualitySettings(QualitySettings.getMaxBarCodes());
reader.readBarCodes().forEach(function(result, i, results)
{
  console.log("BarCode CodeText: " + result.getCodeText());
});
let reader = new BarCodeReader("test.png", null,  [ DecodeType.CODE_39, DecodeType.CODE_128 ]);
//set high performance mode
reader.setQualitySettings(QualitySettings.getHighPerformance());
//set separate options
reader.getQualitySettings().setAllowMedianSmoothing(true);
reader.getQualitySettings().setMedianSmoothingWindowSize(5);
reader.readBarCodes().forEach(function(result, i, results)
{
    console.log("BarCode CodeText: " + result.getCodeText());
});
let reader = new BarCodeReader("test.png", null,  [ DecodeType.CODE_39, DecodeType.CODE_128 ]);
//default mode is NormalQuality
//set separate options
reader.getQualitySettings().setAllowMedianSmoothing(true);
reader.getQualitySettings().setMedianSmoothingWindowSize(5);
reader.readBarCodes().forEach(function(result, i, results)
{
  console.log("BarCode CodeText: " + result.getCodeText());
});

Methods

getAllowIncorrectBarcodes()

Allows engine to recognize barcodes which has incorrect checksumm or incorrect values. Mode can be used to recognize damaged barcodes with incorrect text.

Returns:
Type Description
Allows engine to recognize incorrect barcodes.
Source:

getBarcodeQuality()

Mode which enables methods to recognize barcode elements with the selected quality. Barcode element with lower quality requires more hard methods which slows the recognition.
Returns:
Type Description
Mode which enables methods to recognize barcode elements with the selected quality.
Source:

getComplexBackground()

Mode which enables or disables additional recognition of color barcodes on color images.
Returns:
Type Description
Additional recognition of color barcodes on color images.
Source:

getDeconvolution()

Deconvolution (image restorations) mode which defines level of image degradation. Originally deconvolution is a function which can restore image degraded (convoluted) by any natural function like blur, during obtaining image by camera. Because we cannot detect image function which corrupt the image, we have to check most well know functions like sharp or mathematical morphology.

Returns:
Type Description
Deconvolution mode which defines level of image degradation.
Source:

getInverseImage()

Mode which enables or disables additional recognition of barcodes on images with inverted colors (luminance).

Returns:
Type Description
Additional recognition of barcodes on images with inverse colors
Source:

getMinimalXDimension()

Minimal size of XDimension in pixels which is used with UseMinimalXDimension.
Returns:
Type Description
Minimal size of XDimension in pixels which is used with UseMinimalXDimension.
Source:

getXDimension()

Recognition mode which sets size (from 1 to infinity) of barcode minimal element: matrix cell or bar.
Returns:
Type Description
size (from 1 to infinity) of barcode minimal element: matrix cell or bar.
Source:

setAllowIncorrectBarcodes(value)

Allows engine to recognize barcodes which has incorrect checksumm or incorrect values. Mode can be used to recognize damaged barcodes with incorrect text.

Parameters:
Name Type Description
value Allows engine to recognize incorrect barcodes.
Source:

setBarcodeQuality(value)

Mode which enables methods to recognize barcode elements with the selected quality. Barcode element with lower quality requires more hard methods which slows the recognition.
Parameters:
Name Type Description
value Mode which enables methods to recognize barcode elements with the selected quality.
Source:

setComplexBackground(value)

Mode which enables or disables additional recognition of color barcodes on color images.
Parameters:
Name Type Description
value Additional recognition of color barcodes on color images.
Source:

setDeconvolution(value)

Deconvolution (image restorations) mode which defines level of image degradation. Originally deconvolution is a function which can restore image degraded (convoluted) by any natural function like blur, during obtaining image by camera. Because we cannot detect image function which corrupt the image, we have to check most well know functions like sharp or mathematical morphology.
Parameters:
Name Type Description
value Deconvolution mode which defines level of image degradation.
Source:

setInverseImage(value)

Mode which enables or disables additional recognition of barcodes on images with inverted colors (luminance).
Parameters:
Name Type Description
value Additional recognition of barcodes on images with inverse colors
Source:

setMinimalXDimension(value)

Minimal size of XDimension in pixels which is used with UseMinimalXDimension.
Parameters:
Name Type Description
value Minimal size of XDimension in pixels which is used with UseMinimalXDimension.
Source:

setXDimension(value)

Recognition mode which sets size (from 1 to infinity) of barcode minimal element: matrix cell or bar.
Parameters:
Name Type Description
value (from 1 to infinity) of barcode minimal element: matrix cell or bar.
Source:

(static) getHighPerformance()

HighPerformance recognition quality preset. High quality barcodes are recognized well in this mode.
Source:
Example
let reader = new BarCodeReader("test.png");
reader.setQualitySettings(QualitySettings.getHighPerformance());

(static) getHighQuality()

HighQuality recognition quality preset. This preset is developed for low quality barcodes.
Source:
Example
let reader = new BarCodeReader("test.png");
reader.setQualitySettings(QualitySettings.getHighQuality());

(static) getMaxQuality()

MaxQuality recognition quality preset. This preset is developed to recognize all possible barcodes, even incorrect barcodes.


 This sample shows how to use MaxQuality mode
 

 reader = new BarCodeReader("test.png"null, null, DecodeType.CODE_39_FULL_ASCII, DecodeType.CODE_128);
 {
     reader.setQualitySettings(QualitySettings.getMaxQuality());
     for(let i = 0; i < reader.readBarCodes().length; i++)
         echo (reader.getFoundBarcodes()[i].getCodeText());
 }
	
Value: MaxQuality recognition quality preset.
Source:

(static) getNormalQuality()

NormalQuality recognition quality preset. Suitable for the most of barcodes
Source:
Example
let reader = new BarCodeReader("test.png");
reader.setQualitySettings(QualitySettings.getNormalQuality());