불완전한 바코드 및 이미지 보정
using IronBarCode;
using IronSoftware.Drawing;

// Choose which filters are to be applied (in order)
// Set cacheAtEachIteration = true to save the intermediate image data after each filter is applied
var filtersToApply = new ImageFilterCollection(cacheAtEachIteration: true) {
    new SharpenFilter(),
    new InvertFilter(),
    new ContrastFilter(),
    new BrightnessFilter(),
    new AdaptiveThresholdFilter(),
    new BinaryThresholdFilter(),
    new GaussianBlurFilter(),
    new MedianBlurFilter(),
    new BilateralFilter()
};

BarcodeReaderOptions myOptionsExample = new BarcodeReaderOptions()
{
    // Set chosen filters in BarcodeReaderOptions
    ImageFilters = filtersToApply,

    Speed = ReadingSpeed.Balanced,
    ExpectMultipleBarcodes = true,
};

// Read with the options applied
BarcodeResults results = BarcodeReader.Read("screenshot.png", myOptionsExample);

AnyBitmap[] filteredImages = results.FilterImages();

// Export intermediate image files to disk
for (int i = 0 ; i < filteredImages.Length ; i++)
    filteredImages[i].SaveAs($"{i}_barcode.png");

// Or
results.ExportFilterImagesToDisk("filter-result.jpg");
NuGet Download
PM > Install-Package BarCode
불완전한 바코드 및 이미지 보정

불완전한 바코드 및 이미지 보정

IronBarcode는 BarcodeReaderOptions 내에서 간편하게 적용할 수 있는 여러 이미지 전처리 필터를 제공합니다. 이미지의 판독을 개선할 수 있는 필터를 선택하세요, 예를 들어 Sharpen, 이진 임계값, 및 Contrast. 선택한 순서대로 필터가 적용된다는 점을 기억하십시오.

각 필터를 적용한 중간 이미지의 이미지 데이터를 저장하는 옵션이 있습니다. 이는 ImageFilterCollection의 SaveAtEachIteration 속성으로 토글할 수 있습니다.

주요 코드 예제의 핵심 포인트:

  • 우리는 BarcodeReaderOptions의 인스턴스를 생성하고 다양한 이미지 필터로 구성합니다: Sharpen, Binary Threshold, 및 Contrast.
  • 필터는 적용 순서를 나타내는 특정 순서로 추가됩니다.
  • cacheAtEachIteration를 true로 설정함으로써, 라이브러리는 디버깅 및 분석에 유용한 각 필터 적용 후 중간 이미지를 저장합니다.
  • 마지막으로 이미지에서 바코드를 읽고 바코드 유형과 값을 콘솔에 출력합니다.
IronBarcode에서 이미지 보정에 대해 더 알아보세요
GitHub에서 보기

시작할 준비 되셨나요?

Nuget Downloads 2,540,041버전:2026.11방금 출시