MatchColorPattern Method

NI Vision for Visual Basic

MatchColorPattern Method

Syntax

CWIMAQVision.MatchColorPattern SearchImage, Template, MatchColorPatternOptions, PatternMatchReport [, SearchRectangle]

Return Type

Long

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

Purpose

Searches for a color pattern, or color template image, in the input Image. Use LearnColorPattern prior to using this method to ensure that the color template image has been configured for the color pattern match stage.

Remarks

Use this method with RGB32 and HSL32 images.

Parameters

SearchImage As CWIMAQImage

The color image in which the color template image is to be located.

Template As CWIMAQImage

The color image to be located during the color pattern matching process. The template image is the color image supplied to LearnColorPattern.

MatchColorPatternOptions As CWIMAQMatchColorPatternOptions

A CWIMAQMatchColorPatternOptions object that specifies the parameters the method uses for matching.

PatternMatchReport As CWIMAQPatternMatchReport

On return, a report containing information about each match found in the image.

SearchRectangle As Variant

[Optional] A CWIMAQRectangle object that specifies the rectangular region within an image in which to search for the color template pattern. Do not supply this parameter if you want the entire image to be examined.

Example

Color Pattern Matching Example
Fusebox Inspection Example
Blister Pack Inspection Example

See Also

LearnColorPattern

CWIMAQMatchColorPatternOptions

CWIMAQRectangle

LearnPattern2

MatchPattern2