FilterGradient  Method

Description         This method will filter the image with the Gradient filter. The method works for only monochrome, 8 and 24 bit per pixel images.

Examples

8bitgray                                          macskagradientverticalprewitt

The original 210 x 180 pixel image and the Gradient filtered image with a vertical Prewitt operator.

Syntax                 RetVal = [BiFilter.]FilterGradient  hDib iMode iShowProgress hWnd

Returns               RetVal                    LONGLONG The handle of new filtered DIB, 0 if an error occurred, or -1 if the BIFilter.dll does not installed.

Remarks             hDib                       LONGLONG Handle of the image to filter.

                            iMode                     Long                This parameter specifies the filter matrix and it’s direction.

 

There are the following 7 filters available:

ISOTROPIC - 0

KIRSCH  - 1

PIXELDIFF - 2

PREWIT - 3

SEPPIXDIFF - 4

SOBEL - 5

ROBERTS - 6

 

And there are the following 8 directions available:

NORTH - 0

NORTHEAST - 1

EAST - 2

SOUTHEAST - 3

SOUTH - 4

SOUTHWEST - 5

WEST - 6

NORTHWEST - 7

 

Any filter matrix can be referred as a number or a defined constant.

 

The number :

Number of filter a matrix = 10 * (number of the filter type) + (number of direction).

 

The defined constant :

GRADIENT_<DIRECTION>_<FILTER TYPE>

 

For example: The East-directed Sobel filter can be referred as a number 52 (5*10+2 = 52) or as a defined constant GRADIENT_EAST_SOBEL.

 

See the matrices below.

 

                            iShowProgress       short                This parameter specifies the displaying of the progressbar and the preview dialog.

Available values:

DISPLAY_NONE (0) - The progressbar and the preview dialog will not display before filtering.

DISPLAY_PROGRESS (1) - The progressbar will display during filtering procedure.

DISPLAY_DIALOG (2) - The preview dialog will display before filtering. This dialog shows the part of the image before and after filtering.

DISPLAY_BOTH (3) - The progressbar and the preview dialog will display.

IMPORTANT: The preview dialog will only display, if there is BIDlgs32.dll installed.

                            hWnd                     LONGLONG Handler of the parent window.

 

Here are the matrices of the defined gradient spatial filters for West and North directions. To get the filter matrices to all other directions, just rotate the filter elements around the origin of the matrix (the center element).

Matrix of the Isotropic WEST filter:

Matrix of the Isotropic NORTH filter:

Matrix of the Kirsch WEST filter:

Matrix of the Kirsch NORTH filter:

Matrix of the Pixel Difference WEST filter:

Matrix of the Pixel Difference NORTH filter:

Matrix of the Prewit WEST filter:

Matrix of the Prewit NORTH filter:

Matrix of the Separated Pixel Difference WEST filter:

Matrix of the Separated Pixel Difference NORTH filter:

Matrix of the Sobel WEST filter:

Matrix of the Sobel NORTH filter:

Matrix of the Roberts WEST filter:

Matrix of the Roberts NORTH filter:

See Also              FilterUniform Method, FilterGauss Method, FilterLaplace Method, FilterEnhance Method, FilterWeightedMean Method