Board index » delphi » Q: image brightness & contrast
digitalprosper...@my-deja.com
![]() Delphi Developer |
Tue, 10 Sep 2002 03:00:00 GMT
Q: image brightness & contrast
This is not necessarily a Delphi question only that it will be
programmed in Delphi. I am working on a specialised image processor and the client would like brightness and contrast controls (in grayscale only). I have done brightness but am having problems with contrast - maybe because its the end of the week. :) What I have been working on currently looks like: tempPixel := 128 + (Row[x] - 128) * ContrastAmount where: tempPixel is the new pixel value (the next lines check for out of range) Row[x] is the pixel (Row is a ScanLine) ContrastAmount is either a percentage (-100..100) or similar (ie - 128..128) This sort of works for some low, positive contrast values but the contrast effect is really too much and it causes a negative image with negative contrast values rather than reducing the contrast. So basically this is an algorithm question and a search of news and the net has resulted in me finding some other interesting stuff but not a solution yet. Reiner -- DIGITAL PROSPERITY PTY LTD phone: +61 3 9761-3885 P.O. Box 557 fax: +61 3 9761-3811 Boronia, Victoria 3155 http://www.luck-e-lotto.com.au Sent via Deja.com http://www.deja.com/ |