AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Multimedia Delphi Black and white - advanced
Thema durchsuchen
Ansicht
Themen-Optionen

Black and white - advanced

Ein Thema von WojTec · begonnen am 3. Dez 2010 · letzter Beitrag vom 5. Dez 2010
 
Medium

Registriert seit: 23. Jan 2008
3.689 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
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 13:18 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz