MagicWand Method

NI Vision for Visual Basic

MagicWand Method

Syntax

CWIMAQVision.MagicWand SourceImage, DestImage, x, y [, Tolerance = 20.0] [, Connectivity8 = True] [, ReplacementValue = 1]

Return Type

Long

On success, this method returns 0. On failure, this method returns a negative number.

Purpose

Obsolete—Use MagicWand2 instead. Creates an image mask by extracting a region surrounding a reference pixel, called the origin, and using a tolerance (+ or -) of intensity variations based on this reference pixel. Using this origin, the method searches for its neighbors with an intensity that equals or falls within the tolerance value of the point of reference. The resulting image is binary.

Remarks

Use this method with U8, I16, and SGL images.

DestImage must be a U8 image. If SourceImage and DestImage are the same image, then SourceImage must be a U8 image.

Parameters

SourceImage As CWIMAQImage

The input image.

DestImage As CWIMAQImage

The resulting image.

x As Long

The x-coordinate of the reference point.

y As Long

The y-coordinate of the reference point.

Tolerance As Variant

[Optional] Specifies the pixel value tolerance that the method uses to determine whether neighbors of the reference point are part of the particle.

This parameter has a default value of 20.0.

Connectivity8 As Variant

[Optional] 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.

This parameter has a default value of True.

ReplacementValue As Variant

[Optional] The value to which the method sets pixels in the selected particle. The method sets pixels outside the particle to 0.

This parameter has a default value of 1.

See Also

MagicWand2