C# Class Accord.Imaging.Filters.HitAndMiss

Hit-And-Miss operator from Mathematical Morphology.

The hit-and-miss filter represents generalization of Erosion and Dilatation filters by extending flexibility of structuring element and providing different modes of its work. Structuring element may contain: 1 - foreground; 0 - background; -1 - don't care.

Filter's mode is set by Mode property. The list of modes and its documentation may be found in Modes enumeration.

The filter accepts 8 bpp grayscale images for processing. Note: grayscale images are treated as binary with 0 value equals to black and 255 value equals to white.

Sample usage:

// define kernel to remove pixels on the right side of objects // (pixel is removed, if there is white pixel on the left and // black pixel on the right) short[,] se = new short[,] { { -1, -1, -1 }, { 1, 1, 0 }, { -1, -1, -1 } }; // create filter HitAndMiss filter = new HitAndMiss( se, HitAndMiss.Modes.Thinning ); // apply the filter filter.ApplyInPlace( image );

Initial image:

Result image:

Inheritance: BaseUsingCopyPartialFilter
Afficher le fichier Open project: accord-net/framework

Méthodes publiques

Méthode Description
HitAndMiss ( short se ) : System

Initializes a new instance of the HitAndMiss class.

Structuring elemement for the hit-and-miss morphological operator must be square matrix with odd size in the range of [3, 99].

HitAndMiss ( short se, Modes mode ) : System

Initializes a new instance of the HitAndMiss class.

Méthodes protégées

Méthode Description
ProcessFilter ( UnmanagedImage sourceData, UnmanagedImage destinationData, Rectangle rect ) : void

Process the filter on the specified image.

Method Details

HitAndMiss() public méthode

Initializes a new instance of the HitAndMiss class.

Structuring elemement for the hit-and-miss morphological operator must be square matrix with odd size in the range of [3, 99].

Invalid size of structuring element.
public HitAndMiss ( short se ) : System
se short Structuring element.
Résultat System

HitAndMiss() public méthode

Initializes a new instance of the HitAndMiss class.
public HitAndMiss ( short se, Modes mode ) : System
se short Structuring element.
mode Modes Operation mode.
Résultat System

ProcessFilter() protected méthode

Process the filter on the specified image.
protected ProcessFilter ( UnmanagedImage sourceData, UnmanagedImage destinationData, Rectangle rect ) : void
sourceData UnmanagedImage Source image data.
destinationData UnmanagedImage Destination image data.
rect System.Drawing.Rectangle Image rectangle for processing by the filter.
Résultat void