Automated Tone Adjustment in ACR with Colorchecker

0
704

In previous articles, I had already delved into the importance of tonal adjustment as a contribution to colorimetric accuracy when working in Adobe environments, particularly with Adobe Camera Raw.

In the article “DCP Camera Profiles + Tonal Adjustment = Colorimetric Accuracy” I discussed the importance of tonal adjustment and how to perform these adjustments manually in ACR starting from reference values for ProphotoRGB or AdobeRGB spaces.

However, remember that when working with DCP camera profiles, these only act on the chromatic part of the color (hue), while achromatic adjustments, derived from exposure errors or tonal reproduction related to luminance, must be made with a tonal adjustment curve. Simply loading a camera profile into our ACR will not achieve adequate colorimetric accuracy if we do not perform tonal adjustment and white balance simultaneously. Similarly, ICC color profiles have color transformation structures but also incorporate TRCs to address tonal reproduction issues.

ajuste tonal ACRAlthough these adjustments are not complex, doing them for the 6 patches of our Colorchecker can be frankly tedious. Therefore, to avoid wasting time designing a tonal curve or TRC (Tone Response Curve), I have created a Photoshop Script that automates this process, obtaining quite optimal results in terms of tonal adjustment, which is a good contribution to achieving a certain degree of colorimetric accuracy in workflows with Adobe Camera Raw.

Basis of the tonal curve design script

The operating principle of this script is simple and can be summarized in the following steps:

  1. First, we calculate the RGB values of the neutral patches of our Colorchecker from its spectral measurements in the CIELAB space and, with the help of the ICCLU tool described in the article “ICCLU: Aid for Exposure and Temperature Control,” we can deduce the RGB values equivalent to the AdobeRGB space, so we have reference values: 244, 200, 160, 118, 84, 53.
  2. Through the Photoshop script itself, the average RGB of the pixels of the neutral patches of the Colorchecker is obtained.
  3. Both the obtained values and the reference values are converted to luminance (Y) using the usual formula:
    Y = (0.2126*R) + (0.7152*G) + (0.0722*B)
  4. Subsequently, we find the difference between the obtained luminance values and their reference:
    ΔY = Ye - Ys
  5. Next, we create the curve by generating the usual input and output values. The output values will be calculated using the following formula:
    Output = 255*(10-d/1.01)1/2.2

    Where d is the optical density of the neutral patches of the Colorchecker: 0.05, 0.23, 0.44, 0.7, 1.05, 1.5. Actually, the output values could also be the RGB values for the AdobeRGB space calculated previously, as these approximate quite well. However, I found it more elegant to calculate them from the optical density. These output values (pixel level) will graphically coincide with the peaks of the histogram representation of the background of the Tone Curve panel in our ACR. If you want to know more about optical density, you can consult the previous article “Dynamic Range and Optical Density“.

    The input values will be given by:

    Input = Output - ΔY
  6. In this way, we obtain the input-output values for each patch of our scale, which are updated through the script itself in the .xmp file attached to our raw file in the form, for example, of:
     
      <crs:ToneCurve>
      <rdf:Seq>
      <rdf:li>0, 0</rdf:li>
      <rdf:li>44, 52</rdf:li>
      <rdf:li>66, 84</rdf:li>
      <rdf:li>92, 122</rdf:li>
      <rdf:li>119, 160</rdf:li>
      <rdf:li>146, 199</rdf:li>
      <rdf:li>177, 240</rdf:li>
      <rdf:li>255, 255</rdf:li>
      </rdf:Seq>
      </crs:ToneCurve>
    

Colorimetric and tonal accuracy

Accuracy thresholds can be evaluated through tools such as Imatest or FRAME using tests based on the optoelectronic conversion function (OECF) against a reference curve provided by the colorimetric values of the scale or chart we are using.

precisión ajuste tonal oecf

Precisión colorimetrica

Colorimetric accuracy can be evaluated with similar tools but using delta-e color difference formulas, remembering that the threshold for CIE76 below which two colors are indistinguishable to our visual system is around 2.8, so the further we move from this value, the more different our colors will be from each other.

How to use the automated tonal curve design Script?

The workflow is more or less simple, but for its effectiveness we must be scrupulous with various aspects:

  1. Since what we seek is the colorimetric accuracy of the process, we first design our DCP camera profile (Adobe Digital Camera Profile) from our Colorchecker and the X-RITE or Adobe tool for this purpose.
  2. We open our raw image in Adobe Camera Raw and make several adjustments:
    • Load the camera profile
    • Perform the most accurate white balance possible, verifying if necessary the balance of the RGB channels with the ACR color sample tool.
    • In the Tone Curve menu, choose the “linear” option if any contrast curve is activated by default. This is important because otherwise we would be introducing a tonal adjustment in our measurements.
    • With the crop tool, select the area of our image corresponding to the neutral patch scale of our Colorchecker. Actually, we could also do this in PS, but this way we avoid a step within this tool.
    • Select the AdobeRGB or sRGB color space. This is very important because the work with the ACR tonal adjustment curve is done in gamma 2.2; if we chose ProPhotoRGB, which has a gamma of 1.8, we would encounter an incorrect TRC curve.
    • Some versions of PS, when loading an image for the first time in ACR, load various adjustments such as contrast, brightness, tone curves, etc. It is very important that all the adjustments in our ACR are set to “zero” to avoid introducing variables not representative of our scene. It is advisable to create an ACR “preset” with all these controls disabled to ensure that we do not introduce non-representative variables in our measurements.
  3. We open our image in Photoshop, and from there, through the File > Scripts menu, we can locate and activate the script named TRC4ACR.
  4. Finally, the script will go through the 6 neutral patches of the grayscale, drawing a circle with the sampled area to verify if the sample location was correct. Once the process is finished, this image can be discarded. The script itself will locate and update the .xmp file associated with the raw file we are working with based on the path and name of the loaded image.
  5. Finally, if we reload our raw image in ACR and go to the Tone Curves menu, in the Points tab, we can see the result of the tonal adjustment curve for that scene based on the reference values extracted from our Colorchecker. If we have to process more images taken under the same circumstances, we can create an ACR preset to use for the rest of the images.

Download and installation

You can download the Photoshop script for automated tonal adjustment curve design from Colorchecker charts at this URL:

TRC4ACR

To install it, you must paste it into the directory that Adobe reserves for Photoshop “Presets.” For example, on Mac OS X systems, it is located at:

/Applications/Adobe Photoshop CS4/Presets/

On Windows, it is usually found at:

C:\Archivos de programa\Adobe\Photoshop CS4\Presets

Some frequently asked questions

Why a tonal adjustment?

Tonal adjustment allows us to place each tonal record in its place, with the help of reference values determined by a grayscale or densitometric chart.

Can another chart be used other than a Colorchecker?

In principle, it is possible to use any densitometric scale; however, Adobe only allows defining 16 adjustment points in its tonal adjustment curves, so, for example, charts like the Q13 with 20 samples could not be used. However, obviously, the script parameters must be changed to adapt it to another chart format and reference values.

What does the error: The grayscale of your Colorchecker does not seem well cropped mean?

In the adjustment script, I have incorporated a validation of the proportions of the color scale of our Colorchecker so that the user does not get confused with the choice of the crop of that chart. However, if the crop is not very precise, this alert may appear, which we can initially always ignore as long as we verify that the color sample locations are made within the correct patch.

escala_recortada

What does the error: You are not using AdobeRGB or sRGB mean?

It is essential to use a color space with gamma 2.2 such as AdobeRGB or sRGB to perform the measurements. This situation does not prevent us from finishing our work in another space with a wider gamut like ProPhotoRGB; this step is only necessary for the editing process.

What does the error: Error: XMP Exception: Indexing applied to non… mean?

Currently, this error occurs when the script is unable to locate the .xmp file of your raw. This can happen, for example, when we open the same raw twice in PS, causing it to rename them.

What happens with DNGs?

For the moment, this script only works with raw files, since the metadata is defined in an external XMP file. The difficulty with DNGs is that the metadata, also in XMP format, is packaged within the DNG itself, making access more complex. I will try to study this issue shortly.