imaqMedianFilter

NI Vision for LabWindows/CVI Function

imaqMedianFilter

Usage

int imaqMedianFilter(Image* dest, Image* source, int width, int height, const Image* mask);

Purpose

Filters an image using a nonlinear filter. For each pixel, the algorithm takes the neighborhood specified by the given filter sizes and replaces the pixel with the median value of the neighborhood.

Image Types Supported

IMAQ_IMAGE_U8, IMAQ_IMAGE_I16, IMAQ_IMAGE_SGL

Parameters

Name

Type

Description

dest Image* The destination image.
source Image* The image to filter. The filter modifies the border of the source image. The border must be at least half as large as the larger of the neighborhood dimensions.
width int The width of the rectangular neighborhood around the pixel on which the function operates. This number must be odd.
height int The height of the rectangular neighborhood around the pixel on which the function operates. This number must be odd.
mask const Image* An optional mask. This image must be an IMAQ_IMAGE_U8 image. The function filters only those source pixels whose corresponding mask pixels are non-zero. Set this parameter to NULL to apply the filter to the entire source image.

Return Value

Type

Description

int On success, this function returns a non-zero value. On failure, this function returns 0. To get extended error information, call imaqGetLastError().

Parameter Discussion

source—This function modifies the source image. If you need the original image, create a copy of the image using imaqDuplicate() before using this function.