Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect colors under different illumination conditions

I have a bunch of images of clothes of many colors and I want to detect the colors of each image. Say that I have a blue skirt image in daylight conditions and I can get the correct color through RGB distributions. However, at night it's difficult to tell the color and the "blue" is recognized as "black". It's very hard to make a unified standard to specify colors through RGB distributions.

As such, I am wondering is there a way or algorithm to detect colors under different illuminations?

BTW: I also tried HSV color space and the results were not good.

like image 573
Mickey Shine Avatar asked Mar 17 '15 02:03

Mickey Shine


People also ask

What is the detection of color?

Light travels into the eye to the retina located on the back of the eye. The retina is covered with millions of light sensitive cells called rods and cones. When these cells detect light, they send signals to the brain. Cone cells help detect colors.

Can a laser detect color?

So, yes, lasers can be used to emit only certain colors of light - and the intensity of the light reflected back will depend on the color of the object - a black object will reflect back no colors, a red object will reflect some wavelengths of light in the range of about 650 to 750 nm (nanometers, or billionths of a ...

What is illumination in image processing?

Illumination is divided into incident light, dome light, dark field light, and back light. Based on the different technological approaches, each type of illumination has its respective strengths that can be used for different inspection tasks.

What is illumination computer vision?

In computer vision, illumination is considered to be a problem that needs to be 'solved'. The colour cast due to illumination is removed to support colour-based image recognition and stable tracking (in and out of shadows), among other tasks.


1 Answers

That's a very hard problem and it's still trying to be solved today. The gist of it is to find a colour quantization using a representative set of basic colours of an image that is robust against different external stimuli... lighting, shade, poor illumination etc.

Unfortunately I can't suggest any one algorithm that would do the work for you for all cases. However, one algorithm that has worked for me in the past was when I was doing work in image retrieval. Specifically, the work by Jiebo Luo and David Crandall from Kodak Research Labs: http://vision.soic.indiana.edu/papers/compoundcolor2004cvpr.pdf

The basic algorithm is to take a look at the ISCC-NBS colour palette set. Also, this link is much more fruitful: https://www.w3schools.com/colors/colors_nbs.asp. It is a set of 267 colours that are representative of the colours that we see in modern society today. Usually when we describe colours, we have a set of one or more adjectives, followed by the dominant hue. For example, that shirt is a darkish pale blue, or a light bright yellow, etc. The beauty of this algorithm is that when the colour in question is subject to different external stimuli, we have all of these adjectives that give meaning to the colour, but at the end of the day, the last part of the colour - the dominant hue - is what we're after.

Each of these colours has an associated RGB value. These colours are transformed into the CIE Lab colour space which form a 267 CIE Lab lookup table.

To classify a particular input colour, you would transform this input's RGB values into the CIE Lab colour space, then determine the closest colour to this lookup table. It has been shown that the Euclidean distance between two colours in the CIE Lab colour space best represents the difference in human perception of colours. Once we determine which location in the lookup table the colour is closest to, we strip out all of the adjectives and see what the dominant hue is and we thus classify that colour accordingly.

For example, if we had a RGB pixel and we converted it to Lab, then found that the closest colour was bright yellow, we would remove the "bright" and the final colour that is representative of that RGB pixel would be yellow.


Therefore, the final algorithm is this:

  1. Find the ISCC-NBS colour set's RGB values and convert to CIE Lab and create a lookup table, which I call LUT1. In Python for example, you could simply make this a 2D list or 2D NumPy array.
  2. Create another lookup that stores the dominant hue for each of the colours in the ISCC-NBS colour set - so strip out all of the adjectives and leave the dominant hue, which I call LUT2. In Python for example, you could create a dictionary where the key is the corresponding row of LUT1 and the value would be the actual basic colour itself. Whether it's a string representation or a RGB triplet representing the basic colour is up to you.
  3. For a pixel in question, find the closest ISCC-NBS colour that matches with LUT1 by the Euclidean distance between this pixel's CIE Lab components and the ones in LUT1.
  4. Once we find this location in LUT1, use the same index to index into LUT2 and get the final colour to classify that input pixel's colour.

Hope this helps!

like image 193
rayryeng Avatar answered Oct 25 '22 09:10

rayryeng