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!
source to share
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
source to share