Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
|
14th October 2009, 20:22 | #1 | Link |
der Name sagt alles
Join Date: Jul 2008
Location: Hamburg, Germany
Posts: 37
|
RGB to XYZ colorspace conversion
Hi folks!
I am trying to create content for D-cinema. Therefor I need to do colorspace conversion to XYZ colorspace. I found these RGB/XYZ Matrices but do not really know how to use the values... Does anybody have a clue? All the best! SwK |
15th October 2009, 02:29 | #2 | Link |
x264aholic
Join Date: Jul 2007
Location: New York
Posts: 1,752
|
It's easy.. just do the calculations.
Code:
[X Y Z] = [R G B][a b c] [d e f] [g h i] X = (R * a) + (G * d) + (B * g) Y = (R * b) + (G * e) + (B * h) Z = (R * c) + (G * f) + (B * i) Code:
[a b c] M = [d e f] [g h i] Adobe RGB -> XYZ matrix: [0.5767309 0.2973769 0.0270343] M = [0.1855540 0.6273491 0.0706872] [0.1881852 0.0752741 0.9911085] [X Y Z] = [R G B] M X = (R * 0.5767309) + (G * 0.1855540) + (B * 0.1881852) Y = (R * 0.2973769) + (G * 0.6273491) + (B * 0.0752741) Z = (R * 0.0270343) + (G * 0.0706872) + (B * 0.9911085)
__________________
You can't call your encoding speed slow until you start measuring in seconds per frame. |
15th October 2009, 15:25 | #4 | Link |
Retired AviSynth Dev ;)
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
|
Your input colorspace is probably sRGB and not Adobe RGB.
And you may need to linearize the sRGB, by applying a reverse gamma of 2.2, and some special cases for very small values: http://en.wikipedia.org/wiki/SRGB The linearized sRGB to XYZ is: Code:
0.4124564 0.2126729 0.0193339 0.3575761 0.7151522 0.1191920 0.1804375 0.0721750 0.9503041
__________________
Regards, sh0dan // VoxPod Last edited by sh0dan; 15th October 2009 at 15:27. |
16th October 2009, 12:37 | #5 | Link |
der Name sagt alles
Join Date: Jul 2008
Location: Hamburg, Germany
Posts: 37
|
ooookay...
so I was trying to get that all into a avisynth script, but with minor success..:-( I could not figure out how to combine e.g. X = (R * 0.5767309) + (G * 0.1855540) + (B * 0.1881852) into one new channel... this is my script right now: Code:
vid = Mpeg2source("...").ConvertToRGB24 vidx = RGBAdjust(vid,0.4124564,0.3575761,0.1803475) vidy = RGBAdjust(vid,0.2126729,0.7151522,0.0721750) vidz = RGBAdjust(vid,0.0193339,0.1191920,0.9503041) MergeRGB(vidx,vidy,vidz,"RGB24") The result is just a little more bluish, then the source... I guess, it's not that easy, right?! I attached an image in RGB (the original) and one in xyz colorspace. The xyz should of cause in the end look the same as the rgb, but since IrfanView or sth. can't deal with xyz it looks LSD-ish:-) So, I will have to change the colors to make it look as freaky as the xyz image... for your help! |
16th October 2009, 20:49 | #6 | Link |
x264aholic
Join Date: Jul 2007
Location: New York
Posts: 1,752
|
Avisynth does not support XYZ as far as I know, and if you intend on doing anything serious involving that colorspace, you'll need to get someone (or do it yourself) to add support for XYZ output in avisynth.
Otherwise, your efforts will be (unfortunately) fruitless, since avisynth is limited to YVx and RGB color spaces.
__________________
You can't call your encoding speed slow until you start measuring in seconds per frame. |
22nd October 2009, 04:02 | #8 | Link |
x264aholic
Join Date: Jul 2007
Location: New York
Posts: 1,752
|
Sure, you can adjust it so it's
R = X G = Y B = Z But I don't see how that would be useful at all for you, especially since you can't output XYZ from avisynth without writing a plugin.
__________________
You can't call your encoding speed slow until you start measuring in seconds per frame. |
23rd October 2009, 13:32 | #9 | Link |
der Name sagt alles
Join Date: Jul 2008
Location: Hamburg, Germany
Posts: 37
|
So, the idea was to recolor
R-->X G-->Y B-->Z export as raw images or tiffs and interpret as xyz colorspace afterwards. But I just can't figure out how to recolor properly... what do u think?? |
Tags |
cinema, colormatrix, colorspace, d-cinema, xyz |
Thread Tools | Search this Thread |
Display Modes | |
|
|