2 Replies Latest reply on Oct 17, 2014 6:39 AM by lgs-blad

    Sensor analog balance for 2850K color table

    lgs-blad Level 1



      I currently try to create a dual illuminant camera profile using DNG Profile Editor beta for our Aptina CMOS MT9P031 based camera.


      Using the DNG SDK 1.4, i'm converting the BAYER pattern images to a DNG with a Embedded Profile which has identity matrices set on the color matrixes and analog balance DNG tags.


      D65 shooting conditions:

      - High-CRI LED based light source set to 6500K @ 300 lx (spectrum fit 96%)

      - CMOS sensor analog gains were adapted to achieve a neutral image at the D65 shooting conditions


      a. Do I have to keep all component gains to 1.0 or adjust for the illumination?

      b. Does it matter what I apply on the embedded camera profile on the AnalogBalance DNG tag?


      Std A shooting conditions:

      - Same light source set to 2850K @ 300 lx (spectrum fit 92%)

      - CMOS sensor analog gains were _not_ adapted to achieve a neutral image. This obviously results in a orange color tint which can be eliminated using the white balance slider on the "Color Matrices" tab of the DNG Profile Editor.


      c. Do I have to adapt the analog gains when shooting for 2850K


      Using the converted DNGs from shooting conditions above, I can create the color table for 6500K using the "Chart" tab, but not the 2850K color. I always receive the error message:

      "Non-neutral gray patches. The gray patch in row 4, column 3, has a significant color cast. Please reshoot the chart carefully to avoid color casts and try again."

      ...but when using the whitebalanace slider on the "Color Matrices" tab in advance of the "Chart" tab, I can tune the Std A image to a perfect neutral image. There is no color cast visible anymore.


      d. Any ideas what I did wrong?


      Kind regards


        • 1. Re: Sensor analog balance for 2850K color table
          MadManChan2000 Adobe Employee

          Hi Daniel,


          a.  Sorry, I'm not understanding this question.  Can you clarify?


          b.  The AnalogBalance tag can be handy, for making correspondences between the capture gain conditions and the temperature/tint (white point) that is shown to the user in raw conversion software (such as ACR/Lr).  While you may omit it, the reported temperature/tint values will likely be wacky/incorrect.


          c.  The issue is most likely the fact that we have an internal temperature/tint range that is limited (e.g., 2000 to 50K for temperature, -150 to +150 for tint).  Normally this is not an issue when building color profiles, since the calibration illuminant data is well within these limits (e.g., ~6504 K temp for D65, ~2856 K for Std Illuminant A).  However, when the AnalogBalance and/or ColorMatrix values are missing or set to identity, then there will not be a correct translation between the gains (a.k.a., AsShotNeutral value) and the calibration white point.  This will prevent the white-balancing step from working correctly (*), and explains why you're running into the issue. 


          Ideally you should be setting the ColorMatrix tag for the incandescent case to the matrix that maps the "A" white point to the "as shot neutral" values of the system/sensor under that calibration illuminant (the "as shot neutral" is effectively the reciprocal of the gains).


          d.  See (c) above.


          (*)  Basically, a click-white balance step involves sampling the "raw" or "input" linear values of the click point.  These values are then mapped through the AnalogBalance and ColorMatrix tags to determine the white point (temp/tint values), per Chapter 6 of the DNG spec.  If the values are outside the supported temp/tint range, they are then clipped to the supported range.  The (possibly clipped) white point is then translated back through the ColorMatrix/Analog Balance tags to determine the gains / scale factors used to neutralized or balance the area under the click point. 

          • 2. Re: Re: Sensor analog balance for 2850K color table
            lgs-blad Level 1

            Hi Eric


            Thanks for taking the questions. Some details and clarifications:


            Our analog gains are set to give a neutral image at D65 and we keep them unchanged even if the in-camera white balance algorithm detects a Std. A illuminant. This means the unprocessed RAW image contains a very warm color tint. Obviously, there is much more red than green and blue in the image. Is it correct, that then f.e. apply:

            oNegative->SetAnalogBalance(0.863, 0.599, 0.389);

            -> The values are derived from the red, green and blue components in the 2850K reference image from one of the gray patches on the color checker.


            Thanks for the tip with the missing ColorMatrix values. When I specify a ColorMatrix and AnalogBalance as (described above) I am able to create a color table using the chart tab in Profile Editor the reference image at D65. I keep getting the error for the reference image at 2850K. Did I specify the ColorMatrix the wrong way?


            dng_matrix_3by3 oRGBMatrix( 1.627, -0.448, -0.222,

                                       -0.434,  1.787, -0.350,

                                       -0.341, -2.014,  3.294);

            dng_matrix_3by3 oXYZ_to_SRGB_D65( 3.2404542, -1.5371385, -0.4985314,

                                             -0.9692660,  1.8760108,  0.0415560,

                                              0.0556434, -0.2040259,  1.0572252 );

            dng_matrix_3by3 oCA = MapWhiteMatrix(StdA_xy_coord(), D65_xy_coord());

            oProfile->SetColorMatrix1(oXYZ_to_SRGB_D65 * Invert(oRGBMatrix) * oCA);


            As soon as I open the DNG with values from above in DNG Profiel Editor I get a cold image with a blue color cast and click-white balance tells me ~3350K/28 instead of 2850K/0.