Falsos positivos

This article was translated from English: Does it need improvement?
Translated
View the article in English

¿Cómo eliminar falsos positivos?

Los falsos positivos en la lectura de códigos de barras pueden ocurrir cuando los patrones de fondo complejos se asemejan a códigos de barras o cuando el ruido y los artefactos crean marcas no deseadas que el lector identifica erróneamente como códigos de barras válidos. Se pueden seguir los siguientes pasos para eliminar los falsos positivos del resultado de lectura de IronBarcode:

  1. Especificar Formatos de Código de Barra Esperados: Configure IronBarcode para leer solo los formatos de código de barra que espera. Una lista completa de opciones está disponible aquí: BarcodeEncoding.

  2. Habilitar la Propiedad RemoveFalsePositive: Al escanear códigos de barras, IronBarcode busca regiones "candidatas" en una imagen que probablemente se asemejen a un código de barras, luego intenta decodificar esas regiones. Al establecer esta propiedad en true, IronBarcode solo decodificará las regiones que no tengan errores en su codificación. Por defecto, RemoveFalsePositive ya está configurado en 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
Curtis Chau
Escritor Técnico

Curtis Chau tiene una licenciatura en Ciencias de la Computación (Carleton University) y se especializa en el desarrollo front-end con experiencia en Node.js, TypeScript, JavaScript y React. Apasionado por crear interfaces de usuario intuitivas y estéticamente agradables, disfruta trabajando con frameworks modernos y creando manuales bien ...

Leer más
¿Listo para empezar?
Nuget Descargas 1,979,979 | Version: 2025.11 recién lanzado