This is an old revision of the document!
Support
SUB2r camera starts supporting CCM (a.k.a. CMX) with FX3 v. 58 and FPGA v. 73.
Pixel layout
CCM
Color Correction Matrix is often used as an “add-on” matrix during YUV→RGB conversion. In our case, since the de-bayering and RGB→YUV conversions happen literally on opposite sides of the imaging pipeline, we only use the portion of the corrections designed to compensate for the sensor's cross-talk, converting pre-debayer values \(R_0, Gr_0, Gb_0, B_0\) into \(R, Gr, Gb, B\) that are then used for conversion into RGB:
\[ \begin{bmatrix} B & Gb & Gr & R\end{bmatrix} = \begin{bmatrix} CCM_{00} & CCM_{01} & CCM_{02} & CCM_{03} \\ CCM_{10} & CCM_{11} & CCM_{12} & CCM_{13} \\ CCM_{20} & CCM_{21} & CCM_{22} & CCM_{23} \\ CCM_{30} & CCM_{31} & CCM_{32} & CCM_{33} \end{bmatrix} \cdot \begin{bmatrix} B_0 \\ Gb_0 \\ Gr_0 \\ R_0 \end{bmatrix} \]
In this matrix \(Gb_0\) is a value of “green pixel in a blue row” (i.e. in a B-G-B-G-B-… row) and, similarly, \(Gr_0\) is a value of “green pixel in a red row”.
The matrix is applied to a \(2\times2\) block of \(\begin{bmatrix}B_0 & Gb_0 \\ Gr_0 & R_0\end{bmatrix}\) values represented by a “flattened out” vector \(\begin{bmatrix}B_0 & Gb_0 & Gr_0 & R_0\end{bmatrix}\).
