False Positives
How to Remove False Positives?
False positives in barcode reading can happen when complex background patterns look like barcodes, or when noise and artifacts create unintended marks that the reader mistakenly sees as valid barcodes. The following steps can be taken to remove false positives from IronBarcode's reading output:
- Tell IronBarCode to read only the barcode formats you expect. A complete list of options is shown here: BarcodeEncoding.
- Enable the
RemoveFalsePositive
property. When scanning for barcodes, IronBarcode will search for "candidate" regions of an image for what looks most likely like a barcode, then attempts to decode that region. By setting this totrue
, IronBarcode will only attempt to decode regions that have no errors in their encoding. By default,RemoveFalsePositive
is already set totrue
.
using IronBarCode;
BarcodeReaderOptions myOptionsExample = new BarcodeReaderOptions()
{
// Expect and return barcode results for only the Code 39 type.
ExpectBarcodeTypes = IronBarCode.BarcodeEncoding.Code39,
// Remove false positives.
RemoveFalsePositive = true
};
var results = BarcodeReader.Read("barcode.png", myOptionsExample);
using IronBarCode;
BarcodeReaderOptions myOptionsExample = new BarcodeReaderOptions()
{
// Expect and return barcode results for only the Code 39 type.
ExpectBarcodeTypes = IronBarCode.BarcodeEncoding.Code39,
// Remove false positives.
RemoveFalsePositive = true
};
var results = BarcodeReader.Read("barcode.png", myOptionsExample);
Imports IronBarCode
Private myOptionsExample As New BarcodeReaderOptions() With {
.ExpectBarcodeTypes = IronBarCode.BarcodeEncoding.Code39,
.RemoveFalsePositive = True
}
Private results = BarcodeReader.Read("barcode.png", myOptionsExample)