Chapter 3 Making Grayscale and Color Measurements
© National Instruments Corporation 3-9 IMAQ Vision for Visual Basic User Manual
Comparing Colors
You can use the color matching capability of IMAQ Vision to compare or
evaluate the color content of an image or regions in an image.
Complete the following steps to compare colors using color matching:
1. Select an image containing the color information that you want to use
as a reference. The color information can consist of a single color or
multiple dissimilar colors, such as red and blue.
2. Use the entire image or regions in the image to learn the color
information using CWIMAQVision.LearnColor, which stores the
results of the operation in a CWIMAQColorInformation object that
you supply as a parameter. The color information object has a color
spectrum that contains a compact description of the color information
that you learned. Refer to Chapter 14, Color Inspection, of the
IMAQ Vision Concepts Manual for more information. Use the
CWIMAQColorInformation object to represent the learned color
information for all subsequent matching operations.
3. Define an entire image, a region, or multiple regions in an image as the
inspection or comparison area.
4. Use CWIMAQVision.MatchColor to compare the learned color
information to the color information in the inspection regions. This
method returns an array of scores that indicates how close the matches
are to the learned color information.
5. Use the color matching score as a measure of similarity between the
reference color information and the color information in the image
regions being compared.
Learning Color Information
When learning color information, choose the color information carefully:
Specify an image or regions in an image that contain the color or color
set that you want to learn.
Specify the granularity required to represent the color information.
Choose colors that you want to ignore during matching.