0% found this document useful (0 votes)
5 views2 pages

Match Demo 2009

Uploaded by

benjasepumedina
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Match Demo 2009

Uploaded by

benjasepumedina
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

TAOS/Parallax TCS230/TCS3200/ColorPAL Color-Matching Demo Program

Introduction into Google to uncover a wealth of information.


The TAOS/Parallax color-matching demo Using the Program 2. You may have a poor white or black balance.
program is PC-resident host software that The host program has two modes for viewing
To use the host program, you need to load the
demonstrates the color-matching capabilities of colors: raw and balanced. In raw mode, you see
included TCS230-DB_sense.bpe or TCS230-
their color sensors. With it, you can program up the same uncalibrated colors the sensor sees.
DB_sense.bs2 into the BASIC Stamp to which
to 100 different colors for matching to whatever You can calibrate the sensor by doing a white
the TCS230-DB or TCS3200-DB is connected, or
color the sensor is viewing. The programming is and black balance. With a white piece of paper
the program ColorPAL_sense.bs2 into the
done by showing the sensor a color and under the sensor, click the "Set White" button.
Stamp to which a ColorPAL is connected. After
selecting one of 100 locations in which to store Then, with a black target in place, click the "Set
doing so, leave the serial cable attached, but exit
it. Then, when the sensor is shown another Black" button. This will scale each of the RGB
the debug window. This is important, as the
color, it will select the stored color with the outputs to a 0- 255 range and enter balanced
demo program won't work with an open debug
closest match. mode. You can switch back and forth between
window.
raw and balanced modes with the buttons
Color matching is done using a "minimax"
Next, start the host program. It will scan your provided. You must be in balanced mode,
approach in the RGB color space. In this
serial ports until it finds the BASIC Stamp with however, to store and match colors.
method, the distance between two colors is the
the running demo program. At that point you
absolute value of the difference between the 3. You may have a poor gamma setting.
should see a display similar to the one on the
RGB component that differs most: Computer monitors are inherently non-linear
next page.
devices and display colors poorly without
Di = max{|R - Ri|, |G - Gi|, |B - Bi|}
The current color is displayed in two ways: 1) as precompensating for the nonlinearity. The
where R, G, and B are the red, green, and blue RGB components, and 2) as a composite color. amount of precompensation necessary is
coordinates of the color being scanned; and Ri, Ideally, the composite color displayed on your referred to as gamma. You can adjust this value
Gi, and Bi are the coordinates of stored color i. screen should match the color the sensor is by using the slider provided to get the best
The color with the closest match is taken to be looking at. There are several things that could match across a range of colors.
the one whose Di is the smallest, i.e. prevent this, however:
Once you're getting good visual matches, you
minimizing the maximum difference. Hence the
1. The input might be saturating. This will be can start saving and matching colors. To save a
term "minimax".
evident from a message in the message box that color (until you exit the program), just present
There are many other equally valid ways to says the input is saturating, with one or more that color to the sensor, and left-click on the
measure color distance, and the selection of color components showing a value of 255. If this desired color number. To delete a color, right-
which one to use depends as much on happens, you will need to modify the BASIC click on its number. Once you've saved several
perceptual factors as anything else. You may Stamp demo program. There are three constants colors, you can present colors to the sensor, and
notice that when this program can't find an in this program that govern the interval over the program will select the best match from the
exact match, what it calls the closest color may which each of the RGB components is sampled. colors you've saved. The best match is indicated
not be the one you'd pick. This is because your They are pRED, pGREEN, and pBLUE. You by that color's number flashing on and off. The
perceptual color space is different from the one will want to adjust each one so that, while degree of match for each saved color can be
the program uses for measuring color distance. looking at a white piece of paper, each color observed visually in the black space at the
Color perception and color spaces have been the component will have a value of just under 255. bottom. The farther left the color's number is,
subject of intense research for many decades. You can use the debug output to do this most the better the match.
You can learn more by typing "color-spaces" efficiently.
Message box. Shows progress scanning serial ports, and alerts to saturation condition.
Raw and Balanced buttons.
Select Raw for raw RGB data.
Select Balanced for data Color definition buttons.
after white-balancing is Left click to define as current color.
done. Right click to undefine.
Set White/Black: Click Flashing number indicates closest
when the sensor is seeing color to current color.
a white or black target.

Current RGB values

Current rendered color

Gamma Correction.
Affects PC display only.
Use lower values for more
pre-emphasis on dark
colors.

Color matching space.


The further left a number is,
the closer that color matches
the current color.

Figure 1. Example screen from TCS3200_ColorPAL_match.exe

You might also like