What is the math / algorithm behind Photoshop's Selective Color Filter?

I am working on imaging software for the iPhone and am obsessed with the selective color function like in photoshop.

How to recoup new RGB values ​​after selectively adjusting color per pixel through code?

I mean how to create a tool that has the same function as Photoshop's selective color (In Image-> Adjustment-> Selective Color).

Special thanks!

+3


source to share


3 answers


Finally, I tried image data that had been processed with Photoshop and I got a tinted square-law curve. But this is not exactly the same as Photoshop.



0


source


I came across code that uses an image buffer to manipulate an alpha image, but the same can be used to control the rgb and also see the link



See this example, it will give an overview of image manipulation in object c

0


source


I am also trying to understand the math. Here are some observations from experimenting with pure colors in Absolute mode that, as an end user, are all I care about.

1) As expected, adding the opposite of any color turns the starting color to black. So 100% red + 100% blue = black

2) Adding a neighboring color does nothing. So 100% red + any amount of yellow or magenta = 100% red

3) Adding process colors turns the foreground color into an adjacent one. So 100% red + 100% green = 100% yellow

In RGB space, this means something like

|r'|   |1, 0, 1, 1, 1, 0|   |r|
|y'|   |0, 1, 0, 1, 1, 1|   |y|
|g'|   |1, 0, 1, 0, 1, 1|   |g|
|c'| = |1, 1, 0, 1, 0, 1| * |c|
|b'|   |1, 1, 1, 0, 1, 0|   |b|
|m'|   |0, 1, 1, 1, 0, 1|   |m|

      

There are, of course, adjustments for clipping, from black to white. Here's a more math discussion

http://blog.pkh.me/p/22-understanding-selective-coloring-in-adobe-photoshop.html

0


source







All Articles