Reputation: 5414
I'm attempting to make a photo effect where you subtract one or two channels from a red-green-blue channel triple. Suppose, for example, I don't want any green or red in my final image. One way to do this is to simply zero the green and red components. However, I lose the edges, shape, and shading of many objects with that approach. What I really want is more of a "grayscale with blue hints" effect (especially if that blue can represent the original blue that was in the image). What formula do I use for this?
Upvotes: 2
Views: 1655
Reputation: 3619
Blue = 0.299×Red + 0.587×Green + 0.114×Blue
This formula is quite popular but its incorrect. It will not give you good results. For correct results you might want to go with below formula: first convert to a linear colorspace, then use different weights:
Blue = 0.2126×Red + 0.7152×Green + 0.0722×Blue
Correct approximation is :
Blue = (0.2126×Red^(2.2) + 0.7152×Green^(2.2) + 0.0722×Blue^(2.2))^(1/2.2)
Green=Red=0
Upvotes: 0