![]() |
Color correction matrix | ![]() |
|
IntroductionStarting with Imatest 2.4.1, Multicharts can calculate a color correction matrix that can be applied to images to achieve optimum color balance, as defined by minimizing a color error parameter on the test chart of choice. (The default is the mean of (Delta-E 94)2 for all patches where L*>10 and L*<95.) The matrix can be used by imaging system designers in their cameras or image processing algorithms. For example, Micron sensors use a 3x3 correction matrix. Some of the background for the calculation can be found in Color Correction Matrix for Digital Still and Video Imaging Systems by Stephen Wolf, though the Imatest calculation differs in many respects: there is no issue with outliers and optimization is performed using one of the standard color difference metrics. The color correction matrix is initially included only in Multicharts. In the future it may be added to Colorcheck and additional linearization options will be offered. The MathThe matrixColor images are stored in m x n x 3 arrays (m rows (height) x n columns (width) x 3 colors). For the sake of simplicity, we transform the color image to a k x 3 array, where k = m x n. An Original (uncorrected) array O can be represented as | O_R1 O_G1 O_B1 |
O = | O_R2 O_G2 O_B2 |
| ... |
where O_Ri, O_Gi, and O_Bi represent the normalized R, G, and B levels of pixel i. The transformed (corrected) array is called P, where P = O A (case 1: A is a 3x3 matrix) — or — A is the 3x3 or 4x3 color correction matrix. For the 3x3 matrix, | P_R1 P_G1 P_B1 | | O_R1 O_G1 O_B1 |
P = | P_R2 P_G2 P_B2 | = | O_R2 O_G2 O_B2 | | A11 A12 A13 |
| ... | | ... | X | A21 A22 A23 |
X denotes matrix multiplication. In this case, for row m,
For the 4x3 matrix, a column of 1s is added to provide a dc-offset, | P_R1 P_G1 P_B1 | | O_R1 O_G1 O_B1 1 | | A11 A12 A13 |
P = | P_R2 P_G2 P_B2 | = | O_R2 O_G2 O_B2 1 | | A21 A22 A23 |
| ... | | ... | X | A31 A32 A33 |
In this case, for row m,
The goal of the calculation is to minimize the difference (the mean square error metric) between P and the reference array (the ideal chart values) R. The initial values of A (the starting point for optimization) for the 3x3 and 4x3 cases, are | k_R 0 0 | | k_R 0 0 |
A(3x3) = | 0 k_G 0 | ; A(4x3) = | 0 k_G 0 |
| 0 0 k_B | | 0 0 k_B |
where
These starting values are closer to the final values (have less mean square error) than the identity matrix (k_R = k_G = k_B = 1). They tend to converge slightly better. LinearizationAlthough most digital image sensors are linear up to the point where they saturate, image files are highly nonlinear— they are designed for display at a specified gamma ( γ ), where display luminance = pixel levelγ. Gamma = 2.2 for the most commonly used color spaces (sRGB, Adobe RGB (1998) and Wide Gamut RGB (WGRGB)), although some well-known color spaces are designed for display at gamma = 1.8 (ProPhoto, Apply, ColorMatch; all RGB). When cameras encode images (a part of the RAW conversion process), they apply a gamma that is the approximate inverse of the display gamma. Perhaps we should say very approximate: it may vary considerably from 1/γ, and it often includes a tonal response curve "shoulder" (an area of reduced contrast) to minimize highlight burnout. The shoulder makes the response more "film-like," improving pictorial quality in most instances. The response should be linearized prior to applying the correction matrix, (though Imatest has the option of omitting linearization). Optimization steps
In applying A (generally outside of Imatest), a similar linearization should be used. A may be applied during the RAW conversion process, prior to the application of the gama + tonal response curve. There is no guarantee that A is a global minimum. Its final value depends to some extent on its starting value. The Color correction matrix in Multicharts
The image now shows the corrected colors on the bottom of each patch. The ideal (reference) color remains in the upper-left and the input (original) color remains in the upper right. The button changes to , highlighted with a pink background. The correction matrix cannot be recalculated until an image property changes (new image, color space, reference file, or color matrix setting). The Display input (or Corrected) dropdown menu, immediately to its left, is enabled. You can choose one of two selections.
The EXIF data and Color matrix display has a summary of results.
The color correct matrix, results summary, and both [input - ideal] and [corrected -ideal] color difference summaries are shown. The initial and final error numbers shows how much the selected metric (in this case the sum of squares of Delta-E 94 for all patches with L*>10 and L*<95) has changed. |
|
|||