Class SharpenFilter
A filter to apply Gaussian sharpening to an image.
Inheritance
Implements
Namespace: IronBarCode
Assembly: IronBarCode.dll
Syntax
public class SharpenFilter : Object, IImageFilter
SharpenFilter is the pass that recovers definition in a soft barcode image, applying Gaussian sharpening to pull blurred bar edges back into focus. A code that came out of an out-of-focus camera, a low-resolution capture, or an aggressive upscale loses the crisp boundaries a decoder relies on, and sharpening amplifies the contrast at those transitions so the bars regain a clean edge. It addresses softness rather than noise, so it pairs well after a smoothing filter that has cleaned an image but left it slightly blurred.
The filter implements IImageFilter and is added to the ImageFilterCollection on BarcodeReaderOptions.ImageFilters, where filters run in collection order before the read. A developer constructs it, adds it to the collection, and passes the options to BarcodeReader.Read. The parameterless constructor uses a Sigma of 3.0, the weight that governs how strong the sharpening is. The SharpenFilter(float sigma) overload or the Sigma property raises that value for more aggressive edge enhancement when the image is heavily blurred, though too high a value can over-sharpen and introduce artifacts.
using IronBarCode;
var options = new BarcodeReaderOptions
{
ImageFilters = new ImageFilterCollection { new SharpenFilter() }
};
var results = BarcodeReader.Read("blurry.png", options);The image correction how-to walks through the correction filters on a sample barcode, and the imperfect barcode example reads a degraded image through a filter pipeline.
Constructors
SharpenFilter()
Initializes a new instance of the SharpenFilter class.
Declaration
public SharpenFilter()
SharpenFilter(Single)
Initializes a new instance of the SharpenFilter class with the specified Sigma.
Declaration
public SharpenFilter(float sigma)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | sigma | The 'Sigma' value representing the weight of the blur. |
Properties
Sigma
The 'Sigma' value representing the weight of the blur to remove. Default = 3.0f.
Declaration
public float Sigma { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |