Author Topic: Custom Color Matrix  (Read 4869 times)


  • Newbie
  • *
  • Posts: 35
    • View Profile
Custom Color Matrix
« on: December 02, 2020, 05:56:12 AM »
  I am looking for any kind of information regarding the custom color matrix. I can't seem to find anything online about it at all and the manual just says you need to be a master white balancer to use it without any other kind of info about it... I felt like I was pretty well versed in white balancing but it appears not!
Thank you!
« Last Edit: December 02, 2020, 06:37:27 AM by lcombs »


  • Newbie
  • *
  • Posts: 37
  • 1.4 Color s/n 01266
    • View Profile
Re: Custom Color Matrix
« Reply #1 on: December 08, 2020, 05:17:52 AM »
I've tinkered with the settings to see what effect they had but didn’t learn much from messing with them. I assume you have a grey color balance reference. If not they are cheap on Amazon I use this one

 In regards to color balancing as a pro, you need a video waveform monitor & vector scope plus a set of ‘chip charts’ Grayscale & color. Your shoot these under your lighting. For the grayscale you look at the waveform monitor and minimize the chrominance on the steps using color adjustments. For color balance you look at the color chart and adjust your color balance & luminance so that the vectors hit all of their boxes. At least that’s how it is done in the days of NTSC broadcast TV. Not sure in the digital world these days.


  • Hero Member
  • *****
  • Posts: 740
    • View Profile
Re: Custom Color Matrix
« Reply #2 on: January 03, 2021, 01:51:07 AM »
I now finally read the Manual for the First time, and on page 84 there is this link referenced:


  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Custom Color Matrix
« Reply #3 on: January 20, 2021, 02:17:44 AM »
I'm not a specialist as well, but I did some routines to read out and process the raw images in LabVIEW. If you just display the RGB values as is, you will get an image pretty bad colors for two reasons:

1) The raw images have no gamma correction built in
2) Without applying the color matrix an R pixel will also pick up some green and blue component, the same is true for G and B pixels. I think this is due to the fact the filters on the bayer pattern sensor have to be relatively broadband.

Using the color matrix I have been able to convert from the rawRGB values to sRGB used for display (after interpolation from bayer pattern to full resolution) using the following equation:

sRGB  = ColorMatrix x rawRGB

with sRGB and rawRGB being a column vector of (R,G,B) respectively, and ColorMatrix being the 3x3 matrix as shown in the camera (defaults shown in image attached). Warning: after appling the ColorMatrix you might/will get pixels with R, G or B out of allowed ranges, so you have to clip them to 0/max. I'm not sure, but this might also be related to the limited color space using sRGB.

Afterwards I applied gamma curve and had to strip down R,G,B to 8 bit for display. Finally this has shown the image close to the camera's screen and MP4 playback, so it looks like I guessed well how to process.


  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Custom Color Matrix
« Reply #4 on: February 09, 2021, 12:53:39 AM »
I did some more work decoding all except MP4 Chronos file formats in Octave (should run with Matlab, but not tested). Within these files you will see all the processing to be done from RAW data to final display. If you are interested in the color matrix processing, see the helping function processColor.m

  • readRAW.m
    Read and display a selected frame from a RAW 12Bit or RAW16 Bit file.
  • readDNGorTIFFRAW.m
    Read and display image from DNG or TIFF RAW file.
  • readTIFF8Bit.m
    Read image from 8 Bit TIFF file.
  • IFD_test.m
    Simple program which lists all TAGs found in the selected DNG or TIFF file with their values.

Helper functions for above
  • raw12to16.m: Unpack RAW 12 Bit to 16 Bit values.
  • bayer2rgb.m: very simple bayer decoding. Within the file you can select from binning (forms a single pixel from the 2x2 pattern, fast, output size is half of the initial image) and bilinear interpolation (slower, same size of output).
  • IFDdata.m: Read a TAG from DNG or TIFF files.
  • processColor.m: color processing (bayer pattern, white point, illumination).

•   The code does not have much error checking, so runtime errors are likely if called with invalid parameters or files
•   DNG provides most information required for post processing. For other formats results may vary depending on the lighting conditions, you might have to modify defaults especially for the RAW files.

You migth also be interested in this great article:
« Last Edit: February 09, 2021, 11:07:38 PM by ExlerElektronik »