8 Replies Latest reply on Dec 26, 2016 6:16 AM by gasrios

    Relation between AsShotNeutral and CameraNeutral?

    gasrios

      Hi,

      I am trying to understand what is the relation between tag "AsShotNeutral" (from DNG 1.4.0.0, page 37: "AsShotNeutral specifies the selected white balance at time of capture, encoded as the coordinates of a perfectly neutral color in linear reference space values.") and the value of variable CameraNeutral, used in Chapter 6 to calculate the Camera to XYZ (D50) Transform:

       

      ReferenceNeutral = Inverse(AB * CC) * CameraNeutral

      D = Invert(AsDiagonalMatrix(ReferenceNeutral))

      CameraToXYZ_D50 = FM * D * Inverse(AB * CC)

       

      I assumed AsShotNeutral and CameraNeutral were one and the same, but would like to confirm that. For example, consider the following data, extracted from a real linear DNGfile:

       

      AnalogBalance = [1, 1, 1]

       

      AsShotNeutral = [0.641604, 1, 0.42088]

       

      CameraCalibration1 = CameraCalibration2 = [0.9465, 0, 0, 0, 1, 0, 0, 0, 0.9773]

       

      ForwardMatrix1 = [0.7163, 0.1301, 0.1179, 0.1926, 0.9543, -0.1469, -0.0278, -0.3830, 1.2359]

      ForwardMatrix2 = [0.7239, 0.1838, 0.0566, 0.2467, 1.0246, -0.2713, -0.0112, -0.1754, 1.0117]

       

      ColorMatrix1 = [0.7755, -0.2449, -0.0349, -0.3106, 1.0222, 0.3362, -0.0156, 0.0986, 0.6409]

      ColorMatrix2 = [0.6941, -0.1164, -0.0857, -0.3825, 1.1597, 0.2534, -0.0416, 0.1540, 0.6039]

       

      The CameraToXYZ_D50 matrix calculated from the data above, assuming CameraNeutral = AsShotNeutral, maps camera white [1, 1, 1] to a value different from the expected [96.42, 100, 82.51]. It's possible I'm making a mistake somewhere else, but maybe the issue is as simple as I'm missing some needed conversion from AsShotNeutral to CameraNeutral.

       

      Any help will be greatly appreciated!

       

      Thanks,

       

      Guilherme

        • 1. Re: Relation between AsShotNeutral and CameraNeutral?
          sandy_mc Level 3

          gasrios wrote:

          The CameraToXYZ_D50 matrix calculated from the data above, assuming CameraNeutral = AsShotNeutral, maps camera white [1, 1, 1] to a value different from the expected [96.42, 100, 82.51].

           

          By "camera white" do you mean raw sensor values? If so, why do you expect a mapping from [1,1,1] to D50 white?

          • 2. Re: Relation between AsShotNeutral and CameraNeutral?
            gasrios Level 1

            sandy_mc wrote:

             

            gasrios wrote:

            The CameraToXYZ_D50 matrix calculated from the data above, assuming CameraNeutral = AsShotNeutral, maps camera white [1, 1, 1] to a value different from the expected [96.42, 100, 82.51].

             

            By "camera white" do you mean raw sensor values? If so, why do you expect a mapping from [1,1,1] to D50 white?

            Yes, raw sensor values, already linearized using "adobeDNGConverter -l", so each pixel has three samples, each normalized to the range [0, 1]. The brightest pixel data I have is [1, 1, 1] (image is a bit overexposed).

             

            But you are right, I was wrong to assume [1, 1, 1] would map to D50 white. This is the CameraToXYZ_D50 matrix I have calculated, using the data above:

             

            1.1184403604517807     0.13925591378503085    0.25529432899559246

            0.3145618080001873     0.96628623350256370   -0.39942584053106790

            -0.0389175882358389    -0.34760395341205940    2.84564159307766300

             

            And it correctly maps AsShotNeutral = [0.641604, 1, 0.42088] to D50 white. The problem is, it maps [1, 1, 1] to [1.51, 0.88, 2.46], a value that makes no sense: when I convert it to sRGB, I get [255, 147, 255]. So bright white becomes light pink, and I don't understand why.

             

            So I guess my question is: given all the above information, what am I doing wrong? Why does the matrix map what should be bright white to light pink? There are only so many places the error could be, and I was thinking one possibility was using AsShotNeutral as CameraNeutral is incorrect, maybe there is some additional step I'm missing.

             

            Thanks!

            • 3. Re: Relation between AsShotNeutral and CameraNeutral?
              sandy_mc Level 3

              That's an inherent problem of Bayer sensor cameras. The sensitivities of the various channels are such that one channel will always saturate before others. "Highlight recovery" handles that situation.

              • 4. Re: Relation between AsShotNeutral and CameraNeutral?
                gasrios Level 1

                sandy_mc wrote:

                 

                That's an inherent problem of Bayer sensor cameras. The sensitivities of the various channels are such that one channel will always saturate before others. "Highlight recovery" handles that situation.

                Thanks, I'll try that.

                 

                So, just to close the thread with a final answer to the original question ("Relation between AsShotNeutral and CameraNeutral?"), so it won't mislead people with the same problem that might end up here in the future, it is correct to assume "AsShotNeutral" and "CameraNeutral", as defined in the DNG specification, are the same value, right?

                • 5. Re: Relation between AsShotNeutral and CameraNeutral?
                  sandy_mc Level 3

                  AsShotNeutral and CameraNeutral are not the same value, no. They are however equivalent, so you can transform between them, given a camera matrix, so only one or the other should ever be present.

                  • 6. Re: Relation between AsShotNeutral and CameraNeutral?
                    gasrios Level 1

                    You lost me there. I know there are two tags, AsShotNeutral and AsShotWhiteXY, that cannot be both present at the same time. Then there is CameraNeutral, a value used in Chapter 6 to calculate the CameraToXYZ_D50 matrix, and AFAICT CameraNeutral is not a tag you find in the DNG file, at least not under that name.

                     

                    I was trying to calculate CameraToXYZ_D50 by replacing CameraNeutral with AsShotNeutral. If they are not the same value, then how do I find out the value of CameraNeutral? The spec does say how to calculate CameraNeutral if white balance is specified in terms of a CIE xy coordinate, which I assume to be AsShotWhiteXY, but how do I do it when AsShotNeutral is given?

                    • 7. Re: Relation between AsShotNeutral and CameraNeutral?
                      sandy_mc Level 3

                      Ah, ok, sorry, I misunderstood your question.

                       

                      The answer however, is mostly the same - CameraNeutral in this sense is a transform of the AsShotWhiteXY. It would be same as AsShotNeutral if the camera to XYZ matrix, etc used was the same, but otherwise not. So you should be able to do a "circular" transform, so e.g., CameraNeutral to AsShotWhiteXY to CameraNeutral if you use the same matrix. But bear in mind that there's a twist here. If for example a particular camera manufacturer specifies AsShotWhiteXY in their raw file, you don't necessarily know the matrix that they used, so you can't exactly know that their CameraNeutral values were. You only know the matrix that Adobe used, so your CameraNeutral as calculated may not be the same as what the camera originally thought.

                      • 8. Re: Relation between AsShotNeutral and CameraNeutral?
                        gasrios Level 1

                        That unfortunately makes lots of sense. Thanks for the help!