Quote:
I want to detect the same color in dark and light conditions.
This have nothing to do with programming, it is off topic.
Quote:
but it depends on light conditions.
That is exactly the problem, there is more than 1 light, and its strength is not the only varying part, its color vary too.
The only reliable way to go is for each picture you want to compare, you need a reference part that you will use to detect the difference of light between picture and then do color correction to compare.