LearnColor Method

NI Vision for Visual Basic

LearnColor Method

Syntax

CWIMAQVision.LearnColor SourceImage, ColorInformation [, Regions] [, ColorSensitivity = cwimaqLowColorSensitivity] [, Saturation = 80]

Return Type

Long

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

Purpose

Extracts the color features of an image, which can be used for color matching or other applications related with color information, such as color identification and color image segmentation.

Remarks

Use this method with RGB32 and HSL32 images.

Parameters

SourceImage As CWIMAQImage

The color image from which you want to learn the color(s).

ColorInformation As CWIMAQColorInformation

On return, a CWIMAQColorInformation object containing the color information.

Regions As Variant

[Optional] A CWIMAQRegions object that describes regions in the image that contain the color to be learned. The operation is applied to the entire image if you do not supply this parameter. If regions contains multiple region objects, the color information in all these regions is accumulated before learning.

ColorSensitivity As Variant

[Optional] A CWIMAQColorSensitivities constant that specifies the level of color sensitivity in the image (low, medium, or high). Set this value to cwimaqHighColorSensitivity when you need to distinguish colors with very close hue values.

This parameter has a default value of cwimaqLowColorSensitivity.

Saturation As Variant

[Optional] Sets a threshold value that the method uses to separate colors with similar hues. The method classifies colors below the given saturation value separately from colors above the given saturation value.

This parameter has a default value of 80.

Example

Color Learn Example

See Also

MatchColor

CWIMAQRegions