http://www.mathworks.com/matlabcentral/answers/105120-normalize-colors-under-different-lighting-conditions

 

I have done an outdoor experiment of a camera capturing images every 1 hour for color checker chart. I am trying to normalize each color so it looks the same through the day; as the color constancy is intensity independent.

I have tried several methods but the results were disappointing. Any ideas?

Thanks

---------------------------------------------------------------------------------------------

What methods did you try? Did you try cross channel cubic linear regression?

---------------------------------------------------------------------------------------------

I tried normalization for RGB channels user comprehensive color normalization

No, I haven't tried cross channel cubic linear regression.

---------------------------------------------------------------------------------------------

Try an equation like

newR = a0 + a1*R + a2*G + a3*B + a4*R*G + a5*R*B + a6*G*B + a7*R^2 + a8*G^2 + a9*B^2 + .....

See my attached seminar/tutorial on RGB-to-RGB color correction and RGB-to-LAB color calibration.

 

 

 

 

---------------------------------------------------------------------------------------------

Thank you, this method looks complicated whereas my application is simple. The only thing I want to do is to normalize a color throughout the day. For example, red through the day is shown as [black - brown - red - pink - white - pink - red - brown - black]. I want to stabilize this color to be red during the day. The data was taken from a CMOS imaging sensor.

---------------------------------------------------------------------------------------------

Attached is a super simple (dumb) way of doing it. Not too sophisticated and won't be as good in all situations but it might work for you. I would never use it though because it's not as accurate as we need for industrial use. It's more just for students to learn from.

  • crude_white_balancing.m
  •  

    ---------------------------------------------------------------------------------------------

    Thank you for this file. But this code converts colors to grey scale after correction. I want the result image to be colored

    ---------------------------------------------------------------------------------------------

    The result image is colored. Did you actually run it? With the onion image? And draw out a square over the yellowish onion? You'll see that the final corrected image is color. Try again. Post screenshots if you need to.

    ---------------------------------------------------------------------------------------------

    I don't know why you're processing each quadrilateral individually. Whatever happened to the image (lighting color shift, overall intensity shift, introduction of haze or whatever) most likely affected the whole image. I think if you processed each quadrilateral individually and then came up with 24 individual transforms, and then applied those individual transforms to the same area in the subject image, your subject image would look very choppy. So if your mid gray chip went from greenish in the morning to gray in the mid-day to bluish in the evening, those color shifts would apply to all chips. I've seen a lot of talks and posters at a lot of color conferences and talked to a lot of the worlds experts in color and I don't recall ever seeing anyone do what you want to do. There are situations in spectral estimation where you have a mixture of light (e.g. indoor fluorescent and outdoor daylight) both impinging on a scene and they want to estimate the percentage of light hitting different parts of the scene and the resultant spectrum so that you can get accurate color correction across the different illumination regions but you can't do that on something as small as a single X-rite Color Checker Chart. Anyway even if you did want to chop your scene up into 24 parts and have 24 transforms to fix up each of the 24 regions independently, you'd still have to do one of the methods I showed - either the more accurate regression, or the less accurate linear scaling - or something basically the same concept. You need a transform that take the R, G, and B and gives you a "fixed up" red. And another transform to fix green, and another transform to fix the blue.

    ---------------------------------------------------------------------------------------------

    Thank you very much.

    ---------------------------------------------------------------------------------------------

     

     

    Posted by uniqueone
    ,