# Selective saturation with a color matrix?

This topic is 2768 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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?

##### Share on other sites
use a color LUT which u create in PhotoShop?

##### Share on other sites

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.

##### Share on other sites

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

##### Share on other sites

[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!

1. 1
2. 2
3. 3
Rutin
27
4. 4
khawk
14
5. 5

• 11
• 11
• 23
• 10
• 9
• ### Forum Statistics

• Total Topics
633648
• Total Posts
3013113
×