|
Negative |
trcurvello
Member #7,784
September 2006
|
How can I make to take off the negative of a photo??? |
imaxcs
Member #4,036
November 2003
|
trcurvello
Member #7,784
September 2006
|
using allegro |
Andrei Ellman
Member #3,434
April 2003
|
Find the inverted value of each pixel. Assuming your picture is an image that has 8-bits for each of R,G and B channels, subtract the channel's value from 255 for the 3 channels in the pixel, and do this for all pixels in the image. AE. -- |
trcurvello
Member #7,784
September 2006
|
How I do this in the code??? |
Matt Smith
Member #783
November 2000
|
James Stanley
Member #7,275
May 2006
|
That's not actually a negative though, that's just inverted. A negative is something that might be called solarized. I believe they're different. I could be wrong. |
Jakub Wasilewski
Member #3,653
June 2003
|
Quote: A negative is something that might be called solarized. I believe they're different. I could be wrong. Hm, maybe find out then . --------------------------- |
Arthur Kalliokoski
Second in Command
February 2005
|
"Solarization" refers to extreme overexposure of photographic film, I think it occurred to old TV cameras too. You could see normal parts of the picture the way it was supposed to be, but something extremely bright made some spots dark again. If you see old TV clips from game shows or something from the '50's or '60's, you might notice "flares" with weird effects coming from jewelry reflections of the stage lights etc. They all watch too much MSNBC... they get ideas. |
Jonatan Hedborg
Member #4,886
July 2004
|
In pseudo code, you could probably do something like this: Untested, but i guess that's how it works.
|
James Stanley
Member #7,275
May 2006
|
Quote: Hm, maybe find out [en.wikipedia.org] then . Fair enough . Or, another pseudo-code: |
Andrei Ellman
Member #3,434
April 2003
|
James Stanley said: That's not actually a negative though, that's just inverted. A negative involves inverting all the R, G, and B values, not just the lightness. What you had in mind would result in the correct lightness, but the colours would still be inverted. The algorithm in question for what you had in mind would look something like this. For each pixel If this algorithm was applied to the output (or input) of Jonatan's pseudocode, you'd basically end up with the same effect as Matt Smith's code which is what the negative of an image is. Arthur Kalliokoski said: "Solarization" refers to extreme overexposure of photographic film, I think it occurred to old TV cameras too. Not to mention with my phone's digital camera add-on whenever the sun happens to be in one of my photos. James Stanley said:
For each pixel Which is basically the same code that Matt Smith wrote earlier. AE. -- |
Mr. Big
Member #6,196
September 2005
|
The correct formulae are: Rn = 255 - R Red becomes cyan, green becomes magenta, blue becomes yellow, dark becomes bright and vice versa: (255, 0, 0) <-> (255 - 255, 255 - 0, 255 - 0) <-> (0, 255, 255) |
Fladimir da Gorf
Member #1,565
October 2001
|
Just do: color = ~color. Much easier... OpenLayer has reached a random SVN version number ;) | Online manual | Installation video!| MSVC projects now possible with cmake | Now alvailable as a Dev-C++ Devpack! (Thanks to Kotori) |
Jakub Wasilewski
Member #3,653
June 2003
|
Quote: Just do: color = ~color. Much easier... Yeah, especially fun when alpha 255 becomes alpha 0 and you stop seeing anything when blitting with alpha ). --------------------------- |
Andrei Ellman
Member #3,434
April 2003
|
Quote:
Rn = 255 - R Is it just me or does this thread have an exceptionally high echo??? AE. -- |
Mr. Big
Member #6,196
September 2005
|
\o/! |
|