偽陽性
This article was translated from English: Does it need improvement?
Translated
View the article in English
如何移除偽陽性?
在條碼讀取中,當複雜的背景圖案類似於條碼或者噪點及雜質造成未預期的標記,讀取器誤認為有效條碼時,可能會發生偽陽性。 可以採取以下步驟從IronBarcode的讀取輸出中移除偽陽性:
-
指定預期的條碼格式:配置IronBarcode僅讀取您預期的條碼格式。 完整的選項列表可在此處找到:BarcodeEncoding。
- 啟用
RemoveFalsePositive屬性:在掃描條碼時,IronBarcode會尋找圖片中最可能類似條碼的"候選"區域,然後嘗試解碼這些區域。 通過將此屬性設置為true,IronBarcode只會解碼那些在編碼中沒有錯誤的區域。 在預設情況下,true。
using IronBarCode;
class BarcodeExample
{
static void Main()
{
// Create a BarcodeReaderOptions object with specific parameters.
BarcodeReaderOptions myOptionsExample = new BarcodeReaderOptions()
{
// Expect and return barcode results for only the Code 39 type.
ExpectBarcodeTypes = IronBarCode.BarcodeEncoding.Code39,
// Enable removal of false positives by setting to true.
RemoveFalsePositive = true
};
// Read the barcode from the specified image file using the given options.
var results = BarcodeReader.Read("barcode.png", myOptionsExample);
// Process the results here, e.g., display them, log them, etc.
}
}
using IronBarCode;
class BarcodeExample
{
static void Main()
{
// Create a BarcodeReaderOptions object with specific parameters.
BarcodeReaderOptions myOptionsExample = new BarcodeReaderOptions()
{
// Expect and return barcode results for only the Code 39 type.
ExpectBarcodeTypes = IronBarCode.BarcodeEncoding.Code39,
// Enable removal of false positives by setting to true.
RemoveFalsePositive = true
};
// Read the barcode from the specified image file using the given options.
var results = BarcodeReader.Read("barcode.png", myOptionsExample);
// Process the results here, e.g., display them, log them, etc.
}
}
Imports IronBarCode
Friend Class BarcodeExample
Shared Sub Main()
' Create a BarcodeReaderOptions object with specific parameters.
Dim myOptionsExample As New BarcodeReaderOptions() With {
.ExpectBarcodeTypes = IronBarCode.BarcodeEncoding.Code39,
.RemoveFalsePositive = True
}
' Read the barcode from the specified image file using the given options.
Dim results = BarcodeReader.Read("barcode.png", myOptionsExample)
' Process the results here, e.g., display them, log them, etc.
End Sub
End Class
$vbLabelText
$csharpLabel
準備好開始了嗎?
Nuget 下載 2,317,217 | 版本: 2026.7 剛剛發布

