If any rgb color is input, firstlyexamine thesaturation of the input color.The lower saturation value means that close to gray family color.Our sample codeisdetermined to begraywhen thesaturationvalueis smaller than20.
Input color is examined that standard deviation is lower than threshold.
The lower STD value means that close to gray family color.
Our sample code is determined to be gray when the STD value is smaller than 4.
The value of 4 is heuristic value. When the input color is gray scale, the input color was matched only 0, 1, 10, 11 index in color table.

When the input color is not gray scale, out sample find thesimilarityin the followingfive methods.