QualitySettings
Source: Recognition.
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.
Methods
- getHighPerformance()
- getHighQuality()
- getHighQualityDetection()
- getMaxBarCodes()
- getMaxQualityDetection()
- getNormalQuality()
- applyAll(Src)
- getAllowComplexBackground()
- getAllowDatamatrixIndustrialBarcodes()
- getAllowDecreasedImage()
- getAllowDetectScanGap()
- getAllowIncorrectBarcodes()
- getAllowInvertImage()
- getAllowMedianSmoothing()
- getAllowMicroWhiteSpotsRemoving()
- getAllowOneDAdditionalScan()
- getAllowOneDFastBarcodesDetector()
- getAllowOneDWipedBarsRestoration()
- getAllowQRMicroQrRestoration()
- getAllowRegularImage()
- getAllowSaltAndPaperFiltering()
- getAllowWhiteSpotsRemoving()
- getCheckMore1DVariants()
- getDetectorSettings()
- getFastScanOnly()
- getMedianSmoothingWindowSize()
- getReadTinyBarcodes()
- getUseOldBarcodeDetector()
- setAllowComplexBackground()
- setAllowDatamatrixIndustrialBarcodes()
- setAllowDecreasedImage()
- setAllowDetectScanGap()
- setAllowIncorrectBarcodes()
- setAllowInvertImage()
- setAllowMedianSmoothing()
- setAllowMicroWhiteSpotsRemoving()
- setAllowOneDAdditionalScan()
- setAllowOneDFastBarcodesDetector()
- setAllowOneDWipedBarsRestoration()
- setAllowQRMicroQrRestoration()
- setAllowRegularImage()
- setAllowSaltAndPaperFiltering()
- setAllowWhiteSpotsRemoving()
- setCheckMore1DVariants(value)
- setDetectorSettings()
- setFastScanOnly(value)
- setMedianSmoothingWindowSize()
- setReadTinyBarcodes(value)
- setUseOldBarcodeDetector()
new QualitySettings()
Example
//This sample shows how to use QualitySettings with BarCodeReader
let reader = new BarCodeReader("test.png", null, [ DecodeType.CODE_39_STANDARD, 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_STANDARD, 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_STANDARD, 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_STANDARD, 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_STANDARD, 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_STANDARD, 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
getHighPerformance()
HighPerformance recognition quality preset. High quality barcodes are recognized well in this mode.
Example
let reader = new BarCodeReader("test.png");
reader.setQualitySettings(QualitySettings.getHighPerformance());
getHighQuality()
HighQuality recognition quality preset. This preset is developed for low quality barcodes.
Example
let reader = new BarCodeReader("test.png");
reader.setQualitySettings(QualitySettings.getHighQuality());
getHighQualityDetection()
HighQualityDetection recognition quality preset. Same as NormalQuality but with high quality DetectorSettings
Example
let reader = new BarCodeReader("test.png");
reader.setQualitySettings(QualitySettings.getHighQualityDetection()); *
getMaxBarCodes()
MaxBarCodes recognition quality preset. This preset is developed to recognize all possible barcodes, even incorrect barcodes.
Example
let reader = new BarCodeReader("test.png");
reader.setQualitySettings(QualitySettings.getMaxBarCodes());
getMaxQualityDetection()
MaxQualityDetection recognition quality preset. Same as NormalQuality but with highest quality DetectorSettings. Allows to detect diagonal and damaged barcodes.
Example
let reader = new BarCodeReader("test.png");
reader.setQualitySettings(QualitySettings.getMaxQualityDetection());
getNormalQuality()
NormalQuality recognition quality preset. Suitable for the most of barcodes
Example
let reader = new BarCodeReader("test.png");
reader.setQualitySettings(QualitySettings.getNormalQuality());
applyAll(Src)
apply all values from Src setting to this
Parameter
Name | Type | Optional | Description |
---|---|---|---|
Src |
|
|
source settings |
getAllowComplexBackground()
Allows engine to recognize color barcodes on color background as additional scan. Extremely slow mode.
getAllowDatamatrixIndustrialBarcodes()
Allows engine for Datamatrix to recognize dashed industrial Datamatrix barcodes. Slow mode which helps only for dashed barcodes which consist from spots.
getAllowDecreasedImage()
Allows engine to recognize decreased image as additional scan. Size for decreasing is selected by internal engine algorithms. Mode helps to recognize barcodes which are noised and blurred but captured with high resolution.
getAllowDetectScanGap()
Allows engine to use gap between scans to increase recognition speed. Mode can make recognition problems with low height barcodes.
getAllowIncorrectBarcodes()
Allows engine to recognize barcodes which has incorrect checksumm or incorrect values. Mode can be used to recognize damaged barcodes with incorrect text.
getAllowInvertImage()
Allows engine to recognize inverse color image as additional scan. Mode can be used when barcode is white on black background.
getAllowMedianSmoothing()
Allows engine to enable median smoothing as additional scan. Mode helps to recognize noised barcodes.
getAllowMicroWhiteSpotsRemoving()
Allows engine for Postal barcodes to recognize slightly noised images. Mode helps to recognize sligtly damaged Postal barcodes.
getAllowOneDAdditionalScan()
Allows engine for 1D barcodes to recognize regular image with different params as additional scan. Mode helps to recongize low height 1D barcodes.
getAllowOneDFastBarcodesDetector()
Allows engine for 1D barcodes to quickly recognize high quality barcodes which fill almost whole image. Mode helps to quickly recognize generated barcodes from Internet.
getAllowOneDWipedBarsRestoration()
Allows engine for 1D barcodes to recognize barcodes with single wiped/glued bars in pattern.
getAllowQRMicroQrRestoration()
Allows engine for QR/MicroQR to recognize damaged MicroQR barcodes.
getAllowRegularImage()
Allows engine to recognize regular image without any restorations as main scan. Mode to recognize image as is.
getAllowSaltAndPaperFiltering()
Allows engine to recognize barcodes with salt and paper noise type. Mode can remove small noise with white and black dots.
getAllowWhiteSpotsRemoving()
Allows engine to recognize image without small white spots as additional scan. Mode helps to recognize noised image as well as median smoothing filtering.
getCheckMore1DVariants()
Allows engine to recognize 1D barcodes with checksum by checking more recognition variants. Default value: False.
- Returns
-
If True, allows engine to recognize 1D barcodes with checksum.
getDetectorSettings()
Barcode detector settings.
getFastScanOnly()
Allows engine for 1D barcodes to quickly recognize middle slice of an image and return result without using any time-consuming algorithms.
- Returns
-
Allows engine for 1D barcodes to quickly recognize high quality barcodes.
getMedianSmoothingWindowSize()
Window size for median smoothing. Typical values are 3 or 4. Default value is 3. AllowMedianSmoothing must be set.
getReadTinyBarcodes()
Allows engine to recognize tiny barcodes on large images. Ignored if
- Returns
-
If True, allows engine to recognize tiny barcodes on large images.
getUseOldBarcodeDetector()
Switches to the old barcode detector.
setAllowComplexBackground()
Allows engine to recognize color barcodes on color background as additional scan. Extremely slow mode.
setAllowDatamatrixIndustrialBarcodes()
Allows engine for Datamatrix to recognize dashed industrial Datamatrix barcodes. Slow mode which helps only for dashed barcodes which consist from spots.
setAllowDecreasedImage()
Allows engine to recognize decreased image as additional scan. Size for decreasing is selected by internal engine algorithms. Mode helps to recognize barcodes which are noised and blurred but captured with high resolution.
setAllowDetectScanGap()
Allows engine to use gap between scans to increase recognition speed. Mode can make recognition problems with low height barcodes.
setAllowIncorrectBarcodes()
Allows engine to recognize barcodes which has incorrect checksumm or incorrect values. Mode can be used to recognize damaged barcodes with incorrect text.
setAllowInvertImage()
Allows engine to recognize inverse color image as additional scan. Mode can be used when barcode is white on black background.
setAllowMedianSmoothing()
Allows engine to enable median smoothing as additional scan. Mode helps to recognize noised barcodes.
setAllowMicroWhiteSpotsRemoving()
Allows engine for Postal barcodes to recognize slightly noised images. Mode helps to recognize sligtly damaged Postal barcodes.
setAllowOneDAdditionalScan()
Allows engine for 1D barcodes to recognize regular image with different params as additional scan. Mode helps to recongize low height 1D barcodes.
setAllowOneDFastBarcodesDetector()
Allows engine for 1D barcodes to quickly recognize high quality barcodes which fill almost whole image. Mode helps to quickly recognize generated barcodes from Internet.
setAllowOneDWipedBarsRestoration()
Allows engine for 1D barcodes to recognize barcodes with single wiped/glued bars in pattern.
setAllowQRMicroQrRestoration()
Allows engine for QR/MicroQR to recognize damaged MicroQR barcodes.
setAllowRegularImage()
Allows engine to recognize regular image without any restorations as main scan. Mode to recognize image as is.
setAllowSaltAndPaperFiltering()
Allows engine to recognize barcodes with salt and paper noise type. Mode can remove small noise with white and black dots.
setAllowWhiteSpotsRemoving()
Allows engine to recognize image without small white spots as additional scan. Mode helps to recognize noised image as well as median smoothing filtering.
setCheckMore1DVariants(value)
Allows engine to recognize 1D barcodes with checksum by checking more recognition variants. Default value: False.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
value |
|
|
If True, allows engine to recognize 1D barcodes with checksum. |
setDetectorSettings()
Barcode detector settings.
setFastScanOnly(value)
Allows engine for 1D barcodes to quickly recognize middle slice of an image and return result without using any time-consuming algorithms.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
value |
|
|
Allows engine for 1D barcodes to quickly recognize high quality barcodes. |
setMedianSmoothingWindowSize()
Window size for median smoothing. Typical values are 3 or 4. Default value is 3. AllowMedianSmoothing must be set.
setReadTinyBarcodes(value)
Allows engine to recognize tiny barcodes on large images. Ignored if
Parameter
Name | Type | Optional | Description |
---|---|---|---|
value |
|
|
If True, allows engine to recognize tiny barcodes on large images. |
setUseOldBarcodeDetector()
Switches to the old barcode detector.