National Instruments IMAQTM 用户手册

下载
页码 121
Chapter 3
Making Grayscale and Color Measurements
© National Instruments Corporation
3-11
Using a Region in the Image
You can select a region in the image to provide the color information for 
comparison. A region is helpful for pulling out the useful color information 
in an image. Figure 3-7 shows an example of using a region that contains 
the color information that is important for the application.
 
Figure 3-7.  Using a Single Region to Learn Color Distribution
Using Multiple Regions in the Image
The interaction of light with the object surface creates the observed color of 
that object. The color of a surface depends on the directions of illumination 
and the direction from which the surface is observed. Two identical objects 
may have different appearances because of a difference in positioning or a 
change in the lighting conditions. 
Figure 3-8 shows how light reflects differently off of the 3D surfaces of the 
fuses, resulting in slightly different colors for identical fuses. To view the 
color differences, compare the 3-amp fuse in the upper row with the 3-amp 
fuse in the lower row. 
If you learn the color spectrum by drawing a region of interest around the 
3-amp fuse in the upper row, and then do a color matching for the 3-amp 
fuse in the upper row, you get a very high match score for it—close to 1000. 
The match score for the 3-amp fuse in the lower row is low—around 500. 
This problem could cause a mismatch for the color matching in a fuse box 
inspection process.
The color learning functionality of IMAQ Vision uses a clustering process 
to find the representative colors from the color information specified by one 
or multiple regions in the image. To create a representative color spectrum 
for all 3-amp fuses in the learning phase, draw a Region around the 3-amp 
fuse in the upper row, hold down <Ctrl>, and draw another Region around 
the 3 amp fuse in the lower row. The new color spectrum represents 3-amp