1 | initial version |
No. Color is not an attribute an object does have in real world. It only has a surface that absorbs/rejects certain light frequencies. And depending on the light source that illuminates the object, it will appear to you as green, red or whatever color you perceive. For example a white wall only appears white in sunlight. If you only have a red light bulb as light source, guess what color the wall will have... Now how should a camera know that in sunlight that wall appears white? If you check the pixel's values you will get red as predominant color.
Ok, usually cameras have something called automatic white balance, which tries to guess, what light conditions you have when taking the picture and then corrects the colors towards neutral (sun)light. But this will never work as good as you might need it to get the same RGB values under every light condition for your object.
What you can do is training your system. If, for example, the light conditions only depend on the time (you always have the same light conditions at 6pm) then just measure your object's color values at different times and analyze your image taken at a certain time with the corresponding values.