Choosing a proper color space

In traffic signs, colors whether used in the background or legends are very important in classifying the traffic sign categories. This page will provide the basic introduction on color space and further investigate to choose the proper color space for the traffic sign color decomposition.

Color spaces

Image:rgb_space.png|RGB Image:hsv_space.png|HSV Image:yuv_space.png|YUV Image:ycbcr_space.png|YCbCr Image:cmy_space.png|CMY Image:lms_space.png|LMS Image:xyz_space.png|XYZ Image:lub_space.png|L*u*v* Image:lab_space.png|L*a*b*

MUTCD color specification

The USA FHWA (Federal Highway Administration) has color specifications for retroreflective signing materials which were first developed in the late 1960’s and in 2002, with the technological advances in the manufacturing of signing and markings materials and the measurement of color, they were revised as shown in Table 2 and Table 3 which are daytime color specification limits for retroreflective material. Table 2 has 4 coordinates in x and y components of CIE Yxy color space. These 4 coordinates are vertices of a closed polygon located in the Yxy color space. Therefore any traffic sign printing company should print each color within the specified color range. The luminance factor is stored separately in Table 3 to handle different type of printing materials.

Image:mutcd_color_table1.png|Table 1 Image:mutcd_color_table1a.png|Table 1a Image:mutcd_color_table2.png|Table 2 Image:mutcd_color_table3.png|Table 3 Image:mutcd_color_table3a.png|Table 3a Image:mutcd_color_table4.png|Table 4 Image:mutcd_color_table5.png|Table 5 Image:mutcd_color_table5a.png|Table 5a Image:mutcd_color_table6.png|Table 6

Color code (The meanings of colors)

From http://www.trafficsign.us/signcolor.html MUTCD Color codes

  • Red - used for STOP and Yield signs, multiway supplemental plates, DO NOT ENTER and WRONG WAY signs, for legend or symbols on some regulatory signs, and as part of Interstate and some state route markers
  • Fluorescent Pink - used as background color for incident management signs
  • Coral - reserved for future use
  • Orange - used as background color for temporary traffic control signs
  • Yellow - used as background color for warning signs (except temporary signs) and school signs
  • Fluorescent Yellow-Green - used as background color for pedestrian, bicycle, and school warning signs
  • Green - used as background color for guide and information signs, and for legend on permissive regulation and parking signs
  • Light Blue - reserved for future use
  • Blue - used as background color for traveler services information signs, emergency evacuation route signs, and as part of Interstate and some state route markers
  • Purple - reserved for future use
  • Brown - used as background color for guide and information signs related to points of recreational or cultural interest
  • Black - used as background color for ONE WAY, night speed limit, and truck regulatory signs, and as legend color on signs with white, yellow, orange, fluorescent pink, and fluorescent yellow-green backgrounds
  • White - used as background color for most regulatory signs and some route markers, and as legend color on signs with red, green, blue, brown, and black backgrounds.

Hence, active colors under usage are: Red, Fluorescent Pink, Orange, Yellow, Fluorescent Yellow-Green, Green, Blue, Brown, Black and white - Total 10 colors.

Image:signcolor_red.gif|Red Image:signcolor_flupink.gif|Fluorescent Pink Image:signcolor_coral.gif|Coral Image:signcolor_orange.gif|Orange Image:signcolor_yellow.gif|Yellow Image:signcolor_fluylwgrn.gif|Fluorescent Yellow-Green Image:signcolor_green.gif|Green Image:signcolor_ltblue.gif|Light Blue Image:signcolor_blue.gif|Blue Image:signcolor_purple.gif|Purple Image:signcolor_brown.gif|Brown Image:signcolor_black.gif|Black Image:signcolor_white.gif|White

Also see Sign Colors.

Standard: The colors to be used on standard signs and their specific use on these signs shall be as indicated in the applicable Sections of this Manual. The color coordinates and values shall be as described in 23 CFR, Part 655, Subpart F, Appendix.

Support: As a quick reference, common uses of sign colors are shown in Table 2A-4. Color schemes on specific signs are shown in the illustrations located in each appropriate Section.

Whenever white is specified herein as a color, it is understood to include silver-colored retroreflective coatings or elements that reflect white light.

The colors coral, purple, and light blue are being reserved for uses that will be determined in the future by the Federal Highway Administration. common_uses_of_sign_colors.png

What are chromaticity coordinates?

There is often a need for an intuitive interpretation of colour specification in terms of tristimulus values. This is one reason why the three-dimensional colour colour space defined by X, Y, and Z is often transformed and plotted in terms of a chromaticity diagram. Chromaticity coordinates x, y, and z are derived by calculating the fractional components of the tristimulus values thus:

x = X/(X + Y + Z), y = Y/(X + Y + Z), z = Z/(X + Y + Z).

Since by definition x + y + z = 1, if two of the chromaticity coordinates are known then the third is redundant. Thus, all possible sets of tristimulus values can be represented in a two-dimensional plot of two of these chromaticity coordinates and by convention x and y are always used. A plot of this type is referred to as a chromaticity diagram. The use of chromaticity diagrams has not enabled three-dimensional data to be compressed into two-dimensional data. Consider two samples A and B having specification:

Sample A: X = 10, Y = 20, Z = 30 Sample B: X = 20, Y = 40, Z = 60

Samples A and B have identical chromaticity coordinates but different tristimulus values. The difference between the two samples is one of luminance and B would probably appear brighter than A if the two samples were viewed together. A complete specification using chromaticity coordinates therefore requires two chromaticity coordinates and one of the tristimulus values.

OpenCV cvtColor specification

RGB<=>CIE L*a*b* (CV_BGR2Lab, CV_RGB2Lab, CV_Lab2BGR, CV_Lab2RGB)

// In case of 8-bit and 16-bit images // R, G and B are converted to floating-point format and scaled to fit 0..1 range // convert R,G,B to CIE XYZ |X|    |0.412453  0.357580  0.180423| |R| |Y| <- |0.212671  0.715160  0.072169|*|G| |Z|    |0.019334  0.119193  0.950227| |B|

X <- X/Xn, where Xn = 0.950456 Z <- Z/Zn, where Zn = 1.088754

L <- 116*Y1/3      for Y>0.008856 L <- 903.3*Y      for Y<=0.008856

a <- 500*(f(X)-f(Y)) + delta b <- 200*(f(Y)-f(Z)) + delta where f(t)=t1/3              for t>0.008856      f(t)=7.787*t+16/116   for t<=0.008856 where delta = 128 for 8-bit images, 0 for floating-point images

On output 0≤L≤100, -127≤a≤127, -127≤b≤127 The values are then converted to the destination data type:    8-bit images:        L <- L*255/100, a <- a + 128, b <- b + 128    16-bit images are currently not supported    32-bit images:        L, a, b are left as is

Traffic sign color conversion

8 traffic sign colors (White, black, green, dark blue, brown, red, yellow, dark orange) and one magenta color for the background specification are converted to other color spaces and visualized by normalizing the values of each color space back to 0..255.

Image:trafficsigncolor_3x3_resized.png|RGB Image:trafficsigncolor_hsv_resized.png|HSV Image:trafficsigncolor_ycrcv_resized.png|YCrCb Image:trafficsigncolor_xyz_resized.png|XYZ Image:trafficsigncolor_lab_resized.png|L*a*b*

Traffic sign color correlation

For each color space, the correlation map is computed (0: perfectly correlated, 255: uncorrelated).

Image:trafficsigncolor_3x3_distance.png|RGB Image:trafficsigncolor_hsv_distance.png|HSV Image:trafficsigncolor_ycrcv_distance.png|YCrCb Image:trafficsigncolor_xyz_distance.png|XYZ Image:trafficsigncolor_lab_distance.png|L*a*b*

Real traffic sign test set

A number of real traffic scene captures are selected for the color mapping testing purposes. This is to enumerate the performance of each color space in decomposing the colors down to the ten traffic sign colors. The experiment will follow next week.

Image:color_1.jpg|Sample 1 Image:color_2.jpg|Sample 2 Image:color_3.jpg|Sample 3 Image:color_4.jpg|Sample 4 Image:color_6.jpg|Sample 6 Image:color_7.jpg|Sample 7 Image:color_8.jpg|Sample 8

Image:color_1_corrected.jpg|Color-decomposed sample 1 Image:color_2_corrected.jpg|Color-decomposed sample 2 Image:color_3_corrected.jpg|Color-decomposed sample 3 Image:color_4_corrected.jpg|Color-decomposed sample 4 Image:color_6_corrected.jpg|Color-decomposed sample 6 Image:color_7_corrected.jpg|Color-decomposed sample 7 Image:color_8_corrected.jpg|Color-decomposed sample 8

A sample color distribution visualized in the 3D space is following.

Image:sample_brown.png|Sample traffic sign with selected brown background. Image:sample_rgb.png|RGB Image:sample_yuv.png|YUV Image:sample_hsv.png|HSV Image:sample_cmy.png|CMY Image:sample_lab.png|L*a*b*

The 10 MUTCD color distributions in the real traffic sign images are done manually. Current statics as of 09/16/2006 is following.

  • Manually color-taged files: 1184
  • MUTCD codes: R1-1, R1-2, R2-1, W1-1, W1-2, W1-8
  • Tagged colors (counts), (distinct RGB values):
    • White (598583), (87252)
    • Yellow (344065), (59228)
    • Black (230826), (44425)
    • Red (196528), (67804)

References

CIE

There are two CIE based colour spaces, CIELuv and CIELab. They are nearly linear with visual perception, or at least as close as any colour space is expected to sensibly get. Since they are based on the CIE system of colour measurement, which is itself based on human vision, CIELab and CIELuv are device independent but suffer from being quite unintuitive despite the L parameter having a good correlation with perceived lightness.To make them more user friendly, the CIE defined two analogous spaces - CIELhs or CIELhc where h stands for hue, s for saturation and c for chroma. In addition CIEluv has an associated two-dimensional chromaticity chart which is useful for showing additive colour mixtures, making CIELuv useful in applications using CRT displays. CIELab has no associated two dimensional chromaticity diagram and no correlate of saturation. CIELhs can therefore not be defined.

Colour appearance

The CIE system allows the measurement of colour according to characteristics of human vision. A CIE specification will enable a colour to be made to match another and can be used to predict visual differences between colours. What the CIE system does not tell us is the appearance of a colour. This is because the appearance of colour is influenced by many factors, including the type of lighting, the geometry of the colour surface, and the characteristics of surrounding colours that are in the visual field. To illustrate this effect try placing a small piece of grey card on a variety of different coloured backgrounds, notice how the appearance of the grey patch changes. You can also experiment with this effect using a simple paint program. Draw a number of different coloured boxes on screen and place a small mid-grey coloured box in the centre of each, notice how the appearance of the grey boxes differ even though they are the same colour and, if measured, would give identical CIE values.

This difference between colour measurement and colour appearance can result in problems when trying to match colours between different devices, for example between a hard copy output and an image on a soft display. The CRT will have a specific white point and elements on screen around the image as well as the screen bezel and surroundings will affect the appearance of the image. When printed the printing stock, type of lighting and surrounding elements on the page will have a different affect on appearance. These differences result in colour reproduction that does not appear to match when assessed visually but does match when measured colorimetrically.

It is possible to solve this problem by using a colour appearance space. As yet no international standards exist in this area but several workers have presented methods for deriving and working in colour appearance spaces. One example is Hunt’s appearance space which uses colorimetric measurements of the image as well as of the illuminant, reference white and various regions of the visual field to produce parameters that correlate with the CIE’s definitions of perceived colour – namely lightness, brightness, hue, chroma, colourfulness and saturation. The advantage of such an appearance space is that it enables us to predict what a colour will look like when viewed by a (typical) observer in a variety of conditions. Using such a system it is possible to get accurate colour reproduction between soft display and hard copy at the expense of computational complexity.