偽陽性
Curtis Chau
Updated: 2026年4月22日
如何移除偽陽性?
在條碼讀取中,當複雜的背景圖案類似於條碼或者噪點及雜質造成未預期的標記,讀取器誤認為有效條碼時,可能會發生偽陽性。 可以採取以下步驟從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.
}
}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
技術作家
Curtis Chau擁有Carleton大學的電腦科學學士學位,專精於前端開發,擁有Node.js、TypeScript、JavaScript和React的專業知識。Curtis熱衷於建立直觀且美觀的使用者介面,喜愛使用現代框架並建立結構良好、視覺吸引力的手冊。
...
閱讀更多