Finding points using color location, Finding points using color location -25 – National Instruments IMAQ Vision for Measurement Studio User Manual

Page 71

Advertising
background image

Chapter 5

Machine Vision

© National Instruments Corporation

5-25

IMAQ Vision for LabWindows/CVI User Manual

reference pattern in all cases, you have selected a good template.
Otherwise, refine the current template, or select a better template until both
training and testing are successful.

Finding Points Using Color Location

Color location algorithms provide a quick way to locate regions in an image
with specific colors.

Use color location when your application:

•

Requires the location and the number of regions in an image with their
specific color information

•

Relies on the cumulative color information in the region, instead of the
color arrangement in the region

•

Does not require the orientation of the region

•

Does not always require the location with sub-pixel accuracy

•

Does not require shape information for the region

Follow these general steps to find features in an image using color location:

1.

Define a reference pattern in the form of a template image.

2.

Use the reference pattern to train the color location algorithm with

imaqLearnColorPattern()

.

3.

Define an image or an area of an image as the search area. A small
search area reduces the time to find the features.

4.

Set the

featureMode

element of the

imaqMatchColorPattern()

options parameter to

IMAQ_COLOR_FEATURES

.

5.

Set the tolerances and parameters to specify how the algorithm
operates at run time using the options parameter of

imaqMatchColorPattern()

.

6.

Test the color location algorithm on test images using

imaqMatchColorPattern()

.

7.

Verify the results using a ranking method.

You can save the template image using

imaqWriteVisionFile()

.

Advertising