What exactly is a "color matrix"? - page 2 - RAW Shooting and Processing - CHDK Forum

# What exactly is a "color matrix"?

• 16 Replies
• 18755 Views

#### Howdy

• 21
• [S5 IS]
##### Re: What exactly is a "color matrix"?
« Reply #10 on: 23 / April / 2008, 04:04:57 »
I was refering to this sticky:
http://chdk.setepontos.com/index.php/topic,390.0.html - ArtDen has already found a few matrices

Quote
From my remembering, color space conversion in dcraw is done after debayerization (use -v  option (verbose) and check)

I am sure that XYZ -> RGB is done after debayerization. I am not sure about [Sx, Sy Sz] -> XYZ.

[I missed the /quote mark and so my answer was also quoted - corrected]

#### vit40

• 276
##### Re: What exactly is a "color matrix"?
« Reply #11 on: 23 / April / 2008, 04:24:39 »
After quick look in (for me quite complex) code, I think all color conversions are in  convert_to_rgb() procedure, after interpolation

#### ArtDen

• 175
##### Re: What exactly is a "color matrix"?
« Reply #12 on: 24 / April / 2008, 02:39:52 »
How do you do it in your program?
Module for DNG4PS2 (which calculates color matrix) does like this:
1. Very simple debayering
2. Calculate XYZ
3. Calculate RGB

#### Howdy

• 21
• [S5 IS]
##### Re: What exactly is a "color matrix"?
« Reply #13 on: 24 / April / 2008, 16:14:35 »
Thank you all for the information. I will try to play with it during the weekend and maybe I will learn something

#### toinech

• 105
##### Re: What exactly is a "color matrix"?
« Reply #14 on: 24 / April / 2008, 23:15:40 »
After quick look in (for me quite complex) code, I think all color conversions are in  convert_to_rgb() procedure, after interpolation

Hmmm...
We've got CHDK and in camera RAW information.
I will give the color matrix a try for an in camera custom color, saturation filter
when I am done with the curve project:
Custom processing for JPEG (Tone curve, CA ...)

#### Howdy

• 21
• [S5 IS]
##### Re: What exactly is a "color matrix"?
« Reply #15 on: 25 / April / 2008, 17:31:11 »
*daydreaming mode on*
Hmmm...
Hmmm...

If there was a way of saving the custom white balance along with the RAW file (or even as an additional binary file which then could be automatically processed)....... Maybe by dumping all the camera memory a few times, each time with white balance set to something different....... Maybe then this secret could be retrieved by comparing the dumps.............

*daydreaming mode off*

This all is obviously only a veeeery long shot (and moreover off-topic) but I could not help myself Sometimes there is a grain of sense in even the stupidest foolishness

#### lorenzo353

• 38
##### rgb to xyz conversion and Dcraw processing
« Reply #16 on: 15 / February / 2009, 11:20:57 »
Hello,

without having the knowledge of this discussion, I'm writing a document to understand/explain the CR2 format and Dcraw / DNG processing of RAW images:
http://lclevy.free.fr/cr2/draft/#color

i have described most of the processing, for which I'm 85% certain.

could you please a look at this and point me some errors or additions ?

for example, I can not recovered most of matrix in convert_to_rgb(). are they for the D50 ?
(I'm not a Color science specialist!)

Laurent