Einzelnen Beitrag anzeigen

Medium

Registriert seit: 23. Jan 2008
3.679 Beiträge
 
Delphi 2007 Enterprise
 
#2

AW: Black and white - advanced

  Alt 4. Dez 2010, 00:17
Let's start from how "simple" b&w conversions work: L = (r+g+b)/3 right? So each color component of the rgb model is added together, and then divided by the number of contributors. Written differently this gives:
L = r/3 + g/3 + b/3, or L = i1*r + i2*g + i3*b, with in=1/3
The in can now be changed to control how much the intensity of each channel contributes to the resulting luminance. If we wanted to have green twice the contribution, just double i2. The issue becomes that then the sum of all in becomes different from 1, so all in need to be normalized by sum(in), so that their sum is 1 again.

Photoshop now introduces the channels from the CYM(K) model to that, which we don't have explicitly within RGB. But that's easy to solve: c=(g+b)/2, y=(r+g)/2, m=(r+b)/2.
These can simply be appended to yield the entire formula
L = i1*r + i2*g + i3*b + i4*c + i5*y + i6*m, with the condition that sum(in)=1, and you're done.

Edit:
I don't know how PS handles this, but you could also opt for interpreting 100% as 1/6. This would eliminate the need to normalize, but the result might become too dark. Another way to go about this would be to use 100%=1/3, and only normalize if sum(in)>1. Another option is clipping channels to 1/6 of "MaxChannelValue" (usually 255), but calculate with 100%=1/3. That will let you overshot channels to flat out at high intensities.
There are many ways to handle this, but the really important thing among all of these is, that L never clips over "MaxChannelValue" (you remember the effects of clipping from your last thread ).
"When one person suffers from a delusion, it is called insanity. When a million people suffer from a delusion, it is called religion." (Richard Dawkins)

Geändert von Medium ( 4. Dez 2010 um 00:35 Uhr)
  Mit Zitat antworten Zitat