C# Класс Accord.Imaging.Filters.SISThreshold

Threshold using Simple Image Statistics (SIS).

The filter performs image thresholding calculating threshold automatically using simple image statistics method. For each pixel: two gradients are calculated - ex = |I(x + 1, y) - I(x - 1, y)| and |I(x, y + 1) - I(x, y - 1)|; weight is calculated as maximum of two gradients; sum of weights is updated (weightTotal += weight); sum of weighted pixel values is updated (total += weight * I(x, y)). The result threshold is calculated as sum of weighted pixel values divided by sum of weight.

The filter accepts 8 bpp grayscale images for processing.

Sample usage:

// create filter SISThreshold filter = new SISThreshold( ); // apply the filter filter.ApplyInPlace( image );

Initial image:

Result image (calculated threshold is 127):

Наследование: BaseInPlacePartialFilter
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
CalculateThreshold ( Bitmap image, Rectangle rect ) : int

Calculate binarization threshold for the given image.

The method is used to calculate binarization threshold only. The threshold later may be applied to the image using Threshold image processing filter.

CalculateThreshold ( BitmapData image, Rectangle rect ) : int

Calculate binarization threshold for the given image.

The method is used to calculate binarization threshold only. The threshold later may be applied to the image using Threshold image processing filter.

CalculateThreshold ( UnmanagedImage image, Rectangle rect ) : int

Calculate binarization threshold for the given image.

The method is used to calculate binarization threshold only. The threshold later may be applied to the image using Threshold image processing filter.

SISThreshold ( ) : System

Initializes a new instance of the SISThreshold class.

Защищенные методы

Метод Описание
ProcessFilter ( UnmanagedImage image, Rectangle rect ) : void

Process the filter on the specified image.

Описание методов

CalculateThreshold() публичный Метод

Calculate binarization threshold for the given image.

The method is used to calculate binarization threshold only. The threshold later may be applied to the image using Threshold image processing filter.

Source pixel format is not supported by the routine. It should be /// 8 bpp grayscale (indexed) image.
public CalculateThreshold ( Bitmap image, Rectangle rect ) : int
image System.Drawing.Bitmap Image to calculate binarization threshold for.
rect System.Drawing.Rectangle Rectangle to calculate binarization threshold for.
Результат int

CalculateThreshold() публичный Метод

Calculate binarization threshold for the given image.

The method is used to calculate binarization threshold only. The threshold later may be applied to the image using Threshold image processing filter.

Source pixel format is not supported by the routine. It should be /// 8 bpp grayscale (indexed) image.
public CalculateThreshold ( BitmapData image, Rectangle rect ) : int
image System.Drawing.Imaging.BitmapData Image to calculate binarization threshold for.
rect System.Drawing.Rectangle Rectangle to calculate binarization threshold for.
Результат int

CalculateThreshold() публичный статический Метод

Calculate binarization threshold for the given image.

The method is used to calculate binarization threshold only. The threshold later may be applied to the image using Threshold image processing filter.

Source pixel format is not supported by the routine. It should be /// 8 bpp grayscale (indexed) image.
public static CalculateThreshold ( UnmanagedImage image, Rectangle rect ) : int
image UnmanagedImage Image to calculate binarization threshold for.
rect System.Drawing.Rectangle Rectangle to calculate binarization threshold for.
Результат int

ProcessFilter() защищенный Метод

Process the filter on the specified image.
protected ProcessFilter ( UnmanagedImage image, Rectangle rect ) : void
image UnmanagedImage Source image data.
rect System.Drawing.Rectangle Image rectangle for processing by the filter.
Результат void

SISThreshold() публичный Метод

Initializes a new instance of the SISThreshold class.
public SISThreshold ( ) : System
Результат System