FilterGradient

#include "BIFILTER.H"

 

HANDLE CALLBACK FilterGradient( HANDLE HDIB,
int              iMode,
int              iShowProgress,
HWND     hParent)

Description

This function will filtered the image with the Gradient filter. This function works for only monochrome, 8 bit per bixel 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.

Parameters

HDIB

hDIB

Handle of the DIB to filter.

Int

iMode

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

Available values:

 

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 Programming notes below.

int

iShowProgress

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 BiDlgs.dll installed.

HWND

hParent

Handler of the parent window.

Return values

The handle of the new filtered DIB or NULL if an error occurred.

Programming notes

The function will not free the input DIB.

Here are the matrices of the defined gradient spatiel 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:

Requirements

Header :     Declared in BIFilter.h; include BIFilter.h.

Library :    Use BIFilter.lib.

DLLs :       BIFilter.dll, BiDlgs.dll.