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

Apply filter according to the specified mask.

The image processing routine applies the specified BaseFilter to a source image according to the specified mask - if a pixel/value in the specified mask image/array is set to 0, then the original pixel's value is kept; otherwise the pixel is filtered using the specified base filter.

Mask can be specified as .NET's managed Bitmap, as UnmanagedImage or as byte array. In the case if mask is specified as image, it must be 8 bpp grayscale image. In all case mask size must be the same as size of the image to process.

Pixel formats accepted by this filter are specified by the BaseFilter.

Sample usage:

// create the filter MaskedFilter maskedFilter = new MaskedFilter( new Sepia( ), maskImage ); // apply the filter maskedFilter.ApplyInPlace( image );

Initial image:

Mask image:

Result image:

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

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

Метод Описание
MaskedFilter ( IFilter baseFiler, Bitmap maskImage ) : System

Initializes a new instance of the MaskedFilter class.

MaskedFilter ( IFilter baseFiler, UnmanagedImage unmanagedMaskImage ) : System

Initializes a new instance of the MaskedFilter class.

MaskedFilter ( IFilter baseFiler, byte mask ) : System

Initializes a new instance of the MaskedFilter class.

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

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

Process the filter on the specified image.

Приватные методы

Метод Описание
ProcessImage ( UnmanagedImage image, Rectangle rect, byte mask, int maskLineSize ) : void

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

MaskedFilter() публичный метод

Initializes a new instance of the MaskedFilter class.
public MaskedFilter ( IFilter baseFiler, Bitmap maskImage ) : System
baseFiler IFilter Base filter to apply to the specified source image.
maskImage System.Drawing.Bitmap Mask image to use.
Результат System

MaskedFilter() публичный метод

Initializes a new instance of the MaskedFilter class.
public MaskedFilter ( IFilter baseFiler, UnmanagedImage unmanagedMaskImage ) : System
baseFiler IFilter Base filter to apply to the specified source image.
unmanagedMaskImage UnmanagedImage Unmanaged mask image to use.
Результат System

MaskedFilter() публичный метод

Initializes a new instance of the MaskedFilter class.
public MaskedFilter ( IFilter baseFiler, byte mask ) : System
baseFiler IFilter Base filter to apply to the specified source image.
mask byte to use.
Результат System

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

Process the filter on the specified image.
None of the possible mask properties were set. Need to provide mask before applying the filter. Invalid size of provided mask. Its size must be the same as the size of the image to mask.
protected ProcessFilter ( UnmanagedImage image, Rectangle rect ) : void
image UnmanagedImage Source image data.
rect System.Drawing.Rectangle Image rectangle for processing by the filter.
Результат void