Einzelnen Beitrag anzeigen

WojTec

Registriert seit: 17. Mai 2007
480 Beiträge
 
Delphi XE6 Professional
 
#3

Re: Black and white - advanced

  Alt 4. Dez 2010, 11:14
This is what I wrote:

Delphi-Quellcode:
function Input(AInput: Integer): Single;
begin
  Result := (0.33 * AInput) / 100;
end;

C := (Bits.G + Bits.B) div 2;
M := (Bits.R + Bits.B) div 2;
Y := (Bits.R + Bits.G) div 2;
Luminousity := Round(Bits.R * Input(Reds)) + Round(Bits.G * Input(Greens)) + Round(Bits.B * Input(Blues)) + Round(C * Input(Cyans)) + Round(M * Input(Magentas)) + Round(Y * Input(Yellows));
Luminousity := IntToByte(Luminousity);
For input 40, 60, 40, 60, 20, 80 (default values from PS) result is correct (the same as like with R+G+B/3). Nice. Next I tested maximum white preset (all =100) - correct. Next I got maximum black (all =0) - incorrect, image is black and should be very dark. Last values I got was -40, 235, 144, -68, -3, -107 - effect near to infrared image, in my function also incorrect

It seems that for all values > 0 is ok, but for <= 0 and near 0 result is incorrect How to fix this problem?
Miniaturansicht angehängter Grafiken
incorrect__buuuuu.jpg  
  Mit Zitat antworten Zitat