Color Conversion Matrices

Introduction

ICC profiles do not cover everything a user may wish to do in terms of color manipulation, so additional tools are provided as well. Of course, pixel math is a powerful general purpose tool for manipulating pixels but a common use case is to apply a color correction matrix to data, for example for manual conversion of camera chromaticities.

Warning

Application of CCMs is an advanced technique. Description of techniques involving the use of CCMs is outside the scope of Siril documentation. You should understand how CCMs operate and how to apply them within your workflow in order to use this tool successfully.

ccm dialog

Color Conversion Matrices dialog.

Color Conversion Matrix Tool

The Tools ‣ Color Conversion Matrix tool allows direct application of a color conversion matrix (CCM) to pixels. The CCM is specified by 9 elements:

\[\begin{split}\begin{pmatrix} m_{00} & m_{01} & m_{02} \\ m_{10} & m_{11} & m_{12} \\ m_{20} & m_{21} & m_{22} \end{pmatrix}\end{split}\]

Several common preset are provided in a drop-down selector. The tool additionally offers the ability to scale by a \(\gamma\) factor.

This is applied to pixels as follows:

\[\begin{split}\begin{align} r' &= (m_{00}\cdot r + m_{01}\cdot g + m_{02}\cdot b)^{(-1/\gamma)} \\ g' &= (m_{10}\cdot r + m_{11}\cdot g + m_{12}\cdot b)^{(-1/\gamma)} \\ b' &= (m_{20}\cdot r + m_{21}\cdot g + m_{22}\cdot b)^{(-1/\gamma)} \end{align}\end{split}\]

Warning

If a CCM is applied to an image that has an embedded ICC profile, the ICC profile will no longer be a valid description of the image data. The profile is therefore temporarily disabled and the color management icon will show as inactive. It is assumed that your workflow will involve low-level colorspace transforms and image operations and at some point you will end up transforming the data back to the color space described by the ICC profile. At this point the ICC profile can be reactivated using the bottom of the dialog. If however your workflow involves manual conversion of the image to a different final color space you will need to apply the target ICC profile using the Color Management dialog.

Note that this does not apply to the command line ccm command. By policy, Siril commands do not interact with ICC profiles therefore the ccm command will not disable an ICC profile attached to an image: it is your responsibility to do this using the icc_remove command if required.

This operation can be applied to sequences. Open a sequence and prepare the settings you want to use, then check the Apply to sequence button and define the output prefix of the new sequence (ccm_ by default).

Siril command line

ccm m00 m01 m02 m10 m11 m12 m20 m21 m22 [gamma]
Applies a color conversion matrix to the current image.

There are 9 mandatory arguments corresponding to the 9 matrix elements:

m00, m01, m02
m10, m11, m12
m20, m21, m22

An additional tenth argument [gamma] can be provided: if it is omitted, it defaults to 1.0.

These are applied to each pixel according to the following formulae:

r' = (m00 * r + m01 * g + m02 * b)^(-1/gamma)
g' = (m10 * r + m11 * g + m12 * b)^(-1/gamma)
b' = (m20 * r + m21 * g + m22 * b)^(-1/gamma)

Siril command line

seqccm sequencename [-prefix=]
Same command as CCM but for the the sequence sequencename. Only selected images in the sequence are processed.

The output sequence name starts with the prefix "ccm" unless otherwise specified with option -prefix=

Links: ccm