Color matching quantifies which colors and how much of each color exist in a region of an image and uses this information to check if another image contains the same colors in the same ratio.

Use color matching to compare the color content of an image or regions within an image to a reference color information. With color matching, you create an image or select regions in an image that contain the color information you want to use as a reference. The color information in the image may consist of one or more colors. The machine vision software then learns the 3D color information in the image and represents this information as a 1D color spectrum. Your machine vision application compares the color information in the entire image or regions in the image to the learned color spectrum, calculating a score for each region. The score relates how closely the color information in the image region matches the information represented by the color spectrum.

When to Use

Color matching can be used for applications such as color identification, color inspection, color object location and other applications that require the comparison of color information to make decisions.

Color Identification

Color identification identifies an object by comparing the color information in the image of the object to a database of reference colors that correspond to pre-defined object types. The object is assigned a label corresponding to the object type with closest reference color in the database. Use color matching to first learn the color information of all the pre-defined object types. The color spectrums associated with each of the pre-defined object types become the reference colors. Your machine vision application then uses color matching to compare the color information in the image of the object to the reference color spectrums. The object receives the label of the color spectrum with the highest match score.

The following figure shows an example of a tile identification application. Figure A shows the image of a tile that needs to be identified. Figure B shows the scores obtained using color matching with a set of the reference tiles.

  1. Score = 592
  2.  Score = 6
  3. Score = 31
  4. Score = 338
  5. Score = 1000
  6. Score = 405

Use color matching to verify the presence of correct components in automotive assemblies. An example of a color identification task is to ensure that the color of the fabric in the interior of a car adheres to specifications.

Color Inspection

Color inspection detects simple flaws such as missing or misplaced color components, defects on the surfaces of color objects, or printing errors on color labels. You can use color matching for these applications if known regions of interest predefine the object or areas to be inspected in the image. You can define these regions, or they can be the output of some other machine vision tool, such as pattern matching.

The layout of the fuses in junction boxes in automotive assemblies is easily defined by regions of interest. Color matching determines if all of the fuses are present and in the correct locations. The following figure shows an example of a fuse box inspection application in which the exact location of the fuses in the image can be specified by regions of interest. Color matching compares the color of the fuse in each region to the color that is expected to be in that region.

  1. Score = 51
  2.  Score = 382
  3. Score = 23
  4. Score = 649
  5. Score = 29
  6. Score = 70
  7. Score = 1000
  8. Score = 667
  9. Score = 990
  10. Score = 8
  11. Inspection Ranges

Color matching can be used to inspect printed circuit boards containing a variety of components including diodes, resistors, integrated circuits, and capacitors. In a manufacturing environment, color matching can find flaws in a manufactured product when the flaws are accompanied by a color change.

Concepts

Color matching is performed in two steps. In the first step, the machine vision software learns a reference color distribution. In the second step, the software compares color information from other images to the reference image and returns a score as an indicator of similarity.

Learning Color Distribution

The machine vision software learns a color distribution by generating a color spectrum. You provide the software with an image or regions in the image containing the color information that you want to use as a reference in your application. The machine vision software then generates a color spectrum based on the information you provide. The color spectrum becomes the basis of comparison during the matching phase.

Comparing Color Distributions

During the matching phase, the color spectrum obtained from the target image or region in the target image is compared to the reference color spectrum taken during the learning step. A match score is computed based on the similarity between these two color spectrums using the Manhattan distance between two vectors. A fuzzy membership weighting function is applied to both the color spectrums before computing the distance between them. The weighting function compensates for some errors that may occur during the binning process in the color space. The fuzzy color comparison approach provides a robust and accurate quantitative match score. The match score, ranging from 0 to 1000, defines the similarity between the color spectrums. A score of zero represents no similarity between the color spectrums, whereas a score of 1000 represents a perfect match. The following figure illustrates the comparison process.