imaqMagicWand

NI Vision for LabWindows/CVI Function

imaqMagicWand

Usage

int imaqMagicWand(Image* dest, const Image* source, Point coord, float tolerance, int connectivity8, float replaceValue);

Purpose

Creates a mask of a particle in an image by selecting a particle at the given location and setting all the pixels of that particle to a specified value. The function sets all other pixel values to 0.

Image Types Supported

IMAQ_IMAGE_U8, IMAQ_IMAGE_I16, IMAQ_IMAGE_SGL

Parameters

Name

Type

Description

dest Image* On return, the mask image. This image must be an IMAQ_IMAGE_U8 image.
source const Image* The source image containing the particle to mask.
coord Point The coordinates of the reference point in the particle to mask.
tolerance float Specifies the pixel value tolerance that the function uses to determine whether neighbors of the reference point are part of the particle.
connectivity8 int Set this parameter to TRUE to use connectivity-8 to determine whether pixels are part of the same particle. Set this parameter to FALSE to use connectivity-4 to determine whether pixels are part of the same particle. For more information about connectivity, refer to Chapter 9, Binary Morphology, in the NI Vision Concepts Manual.
replaceValue float The value to which pixels in the selected object are set. Pixels not in the object are set to 0.

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().