Ignoring learned colors, Ignoring learned colors -13 – National Instruments IMAQTM User Manual

Page 42

Advertising
background image

Chapter 3

Making Grayscale and Color Measurements

© National Instruments Corporation

3-13

IMAQ Vision for Visual Basic User Manual

Ignoring Learned Colors

You can ignore certain color components in color matching by setting the
corresponding component in the input color spectrum array to –1. To set a
particular color component, follow these steps:

1.

Copy

CWIMAQColorInformation.ColorSpectrum

, or create your

own array.

2.

Set the corresponding components of the array.

3.

Assign this array to

CWIMAQColorInformation.ColorSpectrum

on the CWIMAQColorInformation object you want to use as input
during the match phase.

For example, setting the last component in the color spectrum to –1 ignores
the color white. Setting the second to last component in the color spectrum
array to –1 ignores the color black. To ignore other color components in
color matching, determine the index to the color spectrum by locating the
corresponding bins in the color wheel, where each bin corresponds to a
component in the color spectrum array. Ignoring certain colors such as the
background color results in a more accurate color matching score. Ignoring
the background color also provides more flexibility when defining the
regions of interest in the color matching process. Ignoring certain colors,
such as the white color created by glare on a metallic surface, also improves
the accuracy of the color matching. Experiment learning the color
information about different parts of the images to determine which colors
to ignore. For more information about the color wheel and color bins, refer
to Chapter 14, Color Inspection, in the IMAQ Vision Concepts Manual.

Advertising