To start with, you need a suitable photo of your color reference card in RAW+JPEG format. It goes beyond the scope of this manual to explain the details of how to take this photo, but in a nutshell you need to make the shot on a sunny day around midday with the light source (sun) shining at an angle onto the card. You need to avoid any glare in the image. The neutral white color patch in the gray ramp (G00) should end up at the L value specified in the description of your card. Often this is L=92 and requires you to overexpose the shot by about 1/3 EV. Ideally you make several shots with slightly different exposures to later select the right one in darktable. Make sure that the chart fills up most of the frame. Take a lens with a “normal” focal length (e.g. 50mm equivalent) and stop down a bit to avoid vignetting.
You then open the raw file in darktable and disable most modules, especially base curve. Select the standard input matrix in the input color profile module and disable gamut clipping. Select “camera white balance” in the white balance module (see Section 184.108.40.206, “Base curve”, Section 220.127.116.11, “Input color profile”, and Section 18.104.22.168, “White balance”).
There is a special situation if your camera automatically applies some lens corrections, namely vignetting correction, to the resulting JPEG file. In this case you need to activate the lens correction module in darktable so that raw processing matches the JPEG in this respect (see Section 22.214.171.124, “Lens correction”).
To output your image you go to the “export” module in darktable (see Section 2.3.12, “Export selected”).
You need to select “Lab” as output color profile. This color space is not
visible in the combobox by default. You first need to enable it by setting
allow_lab_output to TRUE in
Alternatively, you can start darktable with:
darktable --conf allow_lab_output=true
Then select “PFM (float)” as output format and press “export” to generate the source image file.
In a similar way you produce the corresponding reference (target) image from the JPEG. Also this time you need to disable all modules and export with “Lab” output color profile in “PFM (float)” format.