Selective saturation with a color matrix?

Started by
3 comments, last by stele 12 years, 11 months ago
I'm using Haeberli's color matrix stuff to do color correction.
http://www.graficaobscura.com/matrix/index.html
Using a 4x4 matrix I've got hue rotation, general saturation, brightness, contrast, etc.

Now I need to do saturation on the r,g,b primaries. Basically we need to isolate saturation on red, green, and blue. Say you have a picture of a green lawn and a blue sky. Lowering the saturation on "green" should interpolate the green stuff toward gray, leaving the sky alone. So it's not a simple per-channel blend to gray.

I know there is probably a magical matrix solution where you rotate the matrix to get the green channel to line up somehow, then just multiply by some numbers and then rotate back (sort of like was done for the hue/saturation matrix), but the math and order of operations escapes me.

Does anyone have any insight on how this can be done, without going entirely into HSL space?

Advertisement
use a color LUT which u create in PhotoShop?

use a color LUT which u create in PhotoShop?


That would require a 3D lut, and I'd need three of them (one per primary red/green/blue). I really need an algorithmic solution.

That would require a 3D lut, and I'd need three of them (one per primary red/green/blue). I really need an algorithmic solution.


No, it would only require one 3d lut, and it's easier to implement and performs better than any of the traditional algorithmic solutions.

http://renderwonk.co...g_hoffman_b.pdf

[quote name='Stele' timestamp='1305148453' post='4809559']
That would require a 3D lut, and I'd need three of them (one per primary red/green/blue). I really need an algorithmic solution.


No, it would only require one 3d lut, and it's easier to implement and performs better than any of the traditional algorithmic solutions.

http://renderwonk.co...g_hoffman_b.pdf
[/quote]

Yep you're absolutely right - don't know what I was thinking!

I ended up faking it with a round-trip to and from hsl with a couple of 1D luts, but a generalized 3D lut would be much better. Thanks for the pointer to the nice documentation!

This topic is closed to new replies.

Advertisement