imaqNthOrderFilter

NI Vision for LabWindows/CVI Function

imaqNthOrderFilter

Usage

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

Purpose

Filters an image using a non-linear filter. For each pixel, the algorithm takes the neighborhood specified by the given filter sizes and replaces the pixel with the nth smallest value in 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.
n int Specifies which value in the neighborhood to place in the destination. Set n to 0 to select the smallest value in the neighborhood, set n to 1 to select the next smallest value, and so on.
mask const Image* An optional image mask. This image must be an IMAQ_IMAGE_U8 image. The function filters only those pixels in the source image whose corresponding pixels in the mask are non-zero. Set this parameter to NULL to filter 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.