Apply filter according to the specified mask.

Namespace:  AForge.Imaging.Filters
Assembly:  AForge.Imaging (in AForge.Imaging.dll) Version: 2.2.5.0 (2.2.5.0)

Syntax

C#
public class MaskedFilter : BaseInPlacePartialFilter

Remarks

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.

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

Sample usage:

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

Initial image:

Mask image:

Result image:

Inheritance Hierarchy

System..::.Object
  AForge.Imaging.Filters..::.BaseInPlacePartialFilter
    AForge.Imaging.Filters..::.MaskedFilter

See Also