BinarizeBradley

RasterImage.BinarizeBradley method (1 of 2)

Binarization of an image using Bradley’s adaptive thresholding algorithm using the integral image thresholding

public virtual void BinarizeBradley(double brightnessDifference, int windowSize)
Parameter Type Description
brightnessDifference Double The brightness difference between pixel and the average of an s x s window of pixels centered around this pixel.
windowSize Int32 The size of s x s window of pixels centered around this pixel

Examples

The following example binarizes a raster image with Bradley’s adaptive thresholding algorithm with the specified window size. Binarized images contain only 2 colors - black and white.

[C#]

string dir = "c:\\temp\\";

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
{
    Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

    // Binarize the image with a brightness difference of 5. The brightness is a difference between a pixel and the average of an 10 x 10 window of pixels centered around this pixel.
    rasterImage.BinarizeBradley(5, 10);
    rasterImage.Save(dir + "sample.BinarizeBradley5_10x10.png");
}

See Also


RasterImage.BinarizeBradley method (2 of 2)

Binarization of an image using Bradley’s adaptive thresholding algorithm using the integral image thresholding

public virtual void BinarizeBradley(double brightnessDifference)
Parameter Type Description
brightnessDifference Double The brightness difference between pixel and the average of an s x s window of pixels centered around this pixel.

See Also