Since I'm working on a new camera's 2A tuning, I have to calculate the color temperature correctly by myself, but the only data I have is the RAW image that is captured in D65 light source with a Color Checker. Because I'm the camera's developer, I don't have any ICC files to help me calibrate the RAW data.

The algorithm I used (proposed by McCamy - wiki) needs the current device-dependent RGB data to be converted to device-independent color space. Now my problem is that I don't know how to calibrate my data to any device-independent color space (ex. CIE XYZ, sRGB...).

I have searched the existing answers here, and the problem is that I don't know how to find the proper conversion matrix:

[X Y Z]' = [3x3 matrix][R G B]'

Please give me some hints to do this properly, Thanks! and sorry for the unclear question post before.

  • \$\begingroup\$ W. Lee - Welcome to the site! I'm afraid I'm quite unclear as to what topic exactly your question pertains to. I generally understand that you are trying to convert a RAW file to the proper color temperature. What camera captured this image? What exactly is "correct" conversion to you? What algorithm are you talking about? Have you searched this site for existing answers on this topic? What did you find? Did you see: How to estimate colour temperature... \$\endgroup\$
    – dpollitt
    Commented Feb 21, 2016 at 20:48
  • \$\begingroup\$ Thanks for the comment! I have already read this answer before, but my question is that I don't know how to find the matrix that mentioned by the first answer. I have edited my article to make the question more clear, and thanks for the assistance. \$\endgroup\$
    – W. Lee
    Commented Feb 22, 2016 at 0:58
  • \$\begingroup\$ @W.Lee I'm by no means an expert on this topic, though I've done a little bit with color spaces. Did you create the sensor yourself? If not, is it possible the sensor's manufacturer has an ICC profile available? Or maybe could tell you the parameters needed to create one? (Chromaticities, white point, etc.) \$\endgroup\$ Commented Feb 22, 2016 at 2:21
  • \$\begingroup\$ @user1118321 Thanks for the information! I have already ask the vendor of the sensor for the calibration data. However, the calibration data is related to the IR cut and the lens of the camera, so they can not guarantee that there is a universal matrix that can apply to all the system. :( \$\endgroup\$
    – W. Lee
    Commented Feb 22, 2016 at 3:07
  • \$\begingroup\$ I added a meta discussion for this question here: Is this question about device color calibration on topic? \$\endgroup\$
    – dpollitt
    Commented Feb 22, 2016 at 14:42

1 Answer 1


I think you are making this too complex. You have to have a color managed environment as a start (this is the tricky part), plus a qood quality reference (color patch, e.g. this) card, and a good eye (- ask people around, too). Then

  • Take a picture with your camera. You get raw RGB information [RGB]
  • Check the colors on the monitor [XYZ] and tune the adjustment matrix until you see the same colors on the monitor that you have on the reference card. You can do this trial-error, for each color.
  • You end up with some data points in the adjustment matrix for R, G and B. (Ideally this is orthogonal or close to orthogonal, if not, something is not correct in your setup, e.g. changing the red value should not change green and blue channels). Interpolate the points (obviously, more points mean smoother curve).
  • The resulting curves are your ICC profile (Also notice that black is black, so at low intensities the curves should hit the origo. If not, you have some offset error in your setup or your circuit.)

You might want to redo this with multiple monitor calibration, multiple lighting conditions to end up with the correct ICC profile.

Now, if you want to do a decent job, you will have to replace the reference card with monochromatic light sources. That is rather tricky, you either have to use lasers (= limited set of wavelengths) or use white light + prism + slot emitter (= super complex setup) or similar, adjustable monochromatic light emitter.

  • 1
    \$\begingroup\$ Thanks for the answer! I have tried this procedure before, but at that time, I did not sure that this method is the normal way people used to calibrate the data. I used Imatest to help me find the correction matrix, but the results are not good enough for me. I think there might be something wrong in my image pipeline. \$\endgroup\$
    – W. Lee
    Commented Feb 23, 2016 at 3:06
  • 2
    \$\begingroup\$ W. Lee - it is also possible that the sensor doesn't give linear output. If this is the case, you would need to adjust for linear output first and then apply your matrix. That would involve needing a test target for the color of each filter at various percentages and then forming a response curve so you can correct to a linear response. \$\endgroup\$
    – AJ Henderson
    Commented Feb 23, 2016 at 5:32
  • \$\begingroup\$ @AJHenderson Thanks for the good advice! I will check that problem. :) \$\endgroup\$
    – W. Lee
    Commented Feb 23, 2016 at 5:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.