imaqSizeFilter

NI Vision for LabWindows/CVI Function

imaqSizeFilter

Usage

int imaqSizeFilter(Image* dest, Image* source, int connectivity8, int erosions, SizeType keepSize, const StructuringElement* structuringElement);

Purpose

Filters particles based on their size. The algorithm erodes the image a specified number of times and either keeps or discards the particles from the original image that remain in the eroded image.

Image Types Supported

IMAQ_IMAGE_U8

Parameters

Name

Type

Description

dest Image* The destination image.
source Image* The image on which the function applies the filter. The calculation modifies the border of the source image. The border must be at least half as large as the larger of the structuring element dimensions.
connectivity8 int Set this parameter to TRUE to use connectivity-8 to determine whether particles are touching. Set this parameter to FALSE to use connectivity-4 to determine whether particles are touching. For more information about connectivity, see Chapter 9, Binary Morphology, in the NI Vision Concepts Manual.
erosions int The number of erosions to perform.
keepSize SizeType Determines the size of the particles the function keeps after the erosion.
structuringElement const StructuringElement* The structuring element used in the operation. Set this parameter to NULL if you do not want a custom structuring element.

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.