C# Class AForge.Imaging.Filters.ApplyMask

Apply mask to the specified image.

The filter applies mask to the specified image - keeps all pixels in the image if corresponding pixels/values of the mask are not equal to 0. For all 0 pixels/values in mask, corresponding pixels in the source image are set to 0.

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.

The filter accepts 8/16 bpp grayscale and 24/32/48/64 bpp color images for processing.

Inheritance: BaseInPlacePartialFilter
Show file Open project: holisticware-admin/MonoVersal.AForgeNET

Public Methods

Method Description
ApplyMask ( Bitmap maskImage ) : System

Initializes a new instance of the ApplyMask class.

ApplyMask ( UnmanagedImage unmanagedMaskImage ) : System

Initializes a new instance of the ApplyMask class.

ApplyMask ( byte mask ) : System

Initializes a new instance of the ApplyMask class.

Protected Methods

Method Description
ProcessFilter ( UnmanagedImage image, Rectangle rect ) : void

Process the filter on the specified image.

Private Methods

Method Description
ApplyMask ( ) : System
ProcessImage ( UnmanagedImage image, Rectangle rect, byte mask, int maskLineSize ) : void

Method Details

ApplyMask() public method

Initializes a new instance of the ApplyMask class.
public ApplyMask ( Bitmap maskImage ) : System
maskImage System.Drawing.Bitmap Mask image to use.
return System

ApplyMask() public method

Initializes a new instance of the ApplyMask class.
public ApplyMask ( UnmanagedImage unmanagedMaskImage ) : System
unmanagedMaskImage UnmanagedImage Unmanaged mask image to use.
return System

ApplyMask() public method

Initializes a new instance of the ApplyMask class.
public ApplyMask ( byte mask ) : System
mask byte to use.
return System

ProcessFilter() protected method

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.
return void