Log in

View Full Version : colorspace statistics -> ICC Profile?


hanfrunz
22nd February 2004, 17:57
Hello,
i don't know if this is the right forum for my questions, but may one of the mods decide.

I have written a filter named "colorstat", that analyses a RGB32 video. It creates a big (statistic[0xFFFFFF])array of all possible colors. It counts the apperance of each color. In the destructor of the filter a big textfile is written, which looks like that:

65 ; 87 ;245 ; 887654
34 ; 111 ; 78; 554
...

the first three values are RGB and the big number is the count of this color. So 887654 pixels have the color 65/87/245.

Now i'd like to create a ICC-Profile with these informations. So i could use iccview (http://www.iccview.de/index_eng.htm) to visualize it.
And with a second avisynth-filter which not exists right now, i could transform any videofootage to this specific colorspace and maybe it looks like the first video.
I hope i can simulate diffenrent filmlooks with this method. Let's say i analyse the first minutes of "the matrix" with is's green colors, then use the profile to my own dv-holiday-video and get a matrix look.

Does that make any sense? Is it possible? What else could i do with the stats? Could maybe used for a new codec with colormaps like in GIFs?

hanfrunz

trevlac
23rd February 2004, 18:02
Interesting ....

So you want to store the gamut of some clips. Then map your holiday gamut to the matrix gamut?

How would you deal with colors that are not in the new set? If you use the closest color, you could end up with many colors mapping to 1. For example, if everything was green in the new gamut (there would be little magenta). So when converting a range of magenta, if you did a straight mapping you might end up with 1 color over a large area. You could also 'filter out' the red and the blue, but this would make those colors dark. Change the hue and things like skin tones may be off.

The mapping may need a bit of 'smarts' to work well in an automated fashion.

Then again... maybe I'm not understanding what you are saying.

hanfrunz
23rd February 2004, 21:56
hi trevlac,
yes exactly, thats the idea. Have a look at http://www.color.org and http://www.wasatchinc.com/iccintent.html

The ICC defined four different rendering intents. Maybe thats the way to go...

hanfrunz

Richard Berg
25th February 2004, 05:13
FYI, this is kind of how HuffYUV works. Ben made a matrix of the relative frequencies of different strings in a YUV stream. The codec stores this matrix with each file and then records the stream as indexes into the table whose length depends on frequency. (The "matrix" is actually a tree, but you get the idea...)