NET용 1D 바코드 리더
1D 바코드 리더를 사용하여 시작하십시오 .NET
Aspose.BarCode 1D Reader for .NET 은 개발자가 자신의 .NET 애플리케이션 내에서 이미지에서 1D 바코드의 광범위한 범위를 읽고 해독하도록 설계된 강력하고 효율적인 API입니다.이 가이드는 API의 기능과 기능에 대한 완전한 개요를 제공하며 실용적인 C# 코드 예로 빠르고 효과적으로 통합하는 데 도움이됩니다.
지원되는 1D 바코드 상징
우리의 1D 바코드 리더 는 모든 주요 라인 코드 유형을 지원하여 다양한 비즈니스 요구 사항을 처리 할 수 있습니다.
다음 바코드 상징 이 지원됩니다:
- A
- 오프화이트 E
- 에이전트 13
- 이안 8
- 코드 39
- 코드 93
- 코드 128
- 5개 중 2개가 납부되었습니다
- 코드 11
다음은 문서를 사용하여 읽을 수있는 상징을 지정하는 방법에 대한 예입니다 BarcodeReader
클래스:
// Create a new instance of BarcodeReader, specifying Code39
using (Aspose.BarCode.BarCodeRecognition.BarCodeReader reader = new Aspose.BarCode.BarCodeRecognition.BarCodeReader("image.png", Aspose.BarCode.Generation.DecodeType.Code39))
{
// Read the barcode
var result = reader.ReadBarCodes()[0];
Console.WriteLine("Decoded Barcode: " + result.CodeText);
}
사진에서 1D 바코드를 읽고 해독
그들의 BarcodeReader
클래스는 읽기 바코드의 중앙 구성 요소입니다.그것은 이미지 파일, 스트림, 또는 메모리 bitmaps를 처리 할 수 있으며, 스캐너, 카메라 또는 파일 기반 작업 흐름과 같은 다양한 데이터 소스와 무조건 통합을 제공합니다.
파일 경로에서 읽기
바코드를 읽는 가장 간단한 방법은 이미지 파일 경로를 제공함으로써:
// Read from an image file
using (Aspose.BarCode.BarCodeRecognition.BarCodeReader reader = new Aspose.BarCode.BarCodeRecognition.BarCodeReader("image.png"))
{
foreach (var result in reader.ReadBarCodes())
{
Console.WriteLine($"Found Code: {result.CodeText}, Type: {result.CodeType}");
}
}
Image Stream에서 읽기
메모리 또는 네트워크 출처에서 이미지를 처리하는 응용 프로그램에서는 다음과 같은 스트림을 사용할 수 있습니다:
// Read from a stream
using (System.IO.Stream stream = System.IO.File.OpenRead("image.png"))
{
using (Aspose.BarCode.BarCodeRecognition.BarCodeReader reader = new Aspose.BarCode.BarCodeRecognition.BarCodeReader(stream))
{
foreach (var result in reader.ReadBarCodes())
{
Console.WriteLine($"Found Code: {result.CodeText}, Type: {result.CodeType}");
}
}
}
해독된 바코드 데이터에 대한 액세스
각 암호화 된 바코드는 A를 반환합니다 BarCodeResult
개체는 디코딩 된 텍스트, 상징학 유형 및 경계 상자 좌표를 포함하여 풍부한 메타 데이터를 제공합니다.
// Get decoded information
using (Aspose.BarCode.BarCodeRecognition.BarCodeReader reader = new Aspose.BarCode.BarCodeRecognition.BarCodeReader("image.png"))
{
var result = reader.ReadBarCodes()[0];
// Get the symbology and code text
string symbology = result.CodeType.ToString();
string codeText = result.CodeText;
Console.WriteLine($"Symbology: {symbology}, Code Text: {codeText}");
}
고급 기능 및 최적화
기본 읽기 외에도 1D 바코드 리더 는 복잡한 시나리오에서 정확성과 성능을 향상시키는 강력한 기능을 제공합니다.
- Rotation and Skew Compensation : 우리의 API는 자동으로 회전 및 전망 변형을 감지하고 수정합니다. 이상한 각도에서 캡처 된 바코드는 사전 처리없이 신뢰할 수 있습니다.
- Custom Interest Region (ROI) : 그림 내의 특정 직경 영역으로 스캔을 제한합니다.이것은 배코드의 위치를 알면 해독을 극도로 가속화하고 가짜 긍정적 인 점을 줄입니다.
- Batch 및 Parallel Processing : 대량 서비스의 경우 도서관은 여러 이미지 또는 스트립을 통해 병렬 해독을 지원합니다.
- Error Detection and Correction: 리더는 지원되는 내장 체크 및 오류 수정 메커니즘을 사용하여 부적절한 바코드를 표시하고 각 읽기에 대한 신뢰 점수를 제공합니다.
예: 실수 처리 은혜로
바코드가 읽을 수 없거나 발견되지 않은 시나리오를 관리하기 위해 오류 처리를 구현하는 것이 중요합니다.
try
{
using (Aspose.BarCode.BarCodeRecognition.BarCodeReader reader = new Aspose.BarCode.BarCodeRecognition.BarCodeReader("damaged_image.png"))
{
if (reader.ReadBarCodes().Length > 0)
{
var result = reader.ReadBarCodes()[0];
Console.WriteLine($"Successfully read barcode: {result.CodeText}");
}
else
{
Console.WriteLine("No barcode found in the image.");
}
}
}
catch (Aspose.BarCode.BarCodeRecognition.BarCodeException ex)
{
Console.WriteLine("Error reading barcode: " + ex.Message);
}
설치 및 설정
Aspose.BarCode 1D Reader 로 시작하는 것은 간단합니다.
- NuGet을 통해 설치 : 추가
Aspose.BarCode
NuGet Package Manager를 사용하여 프로젝트에 패키지를 제공합니다. - **Licensing ** : 생산용으로는 metered license 를 설정하십시오 미터 라이센스 가이드 .
이 가이드를 따르면서, 당신은 강력하고 확장 가능한 솔루션을 구축 할 수 있습니다 **1D 바코드 데이터 ** 거의 모든 이미지 출처를 사용하여 Aspose.BarCode 1D Reader for .NET.