i’m searching a algorithm to produce a solarisation effect of a picture. Have someone a link or a algorithm? I#m interessted in other filters too, like sepia or cartoon. For sepia i found some code here. On the web i found not much infos about the implementation of those filters.
greetings
solarisation means that the response curve is not monotonic (instead of simply increasing in brightness, the “output” starts bright, gets dimmer, and then increases again, as the “input” gets brighter). the easiest way to implement it (for some value of easy) is as a special case of a more general process which transforms pixel values.
here’s some python-ish pseudocode for the main routine:
if we choose pixels to be values between 0 and 1 (normalise whatever values you have, and if you have colours treat R, G and B the same) then you can modify gamma (change contrast) by using
for solarisation, you need a function that decreases then increases again. so something like 1-4x+4x^2:
in case that’s all a bit opaque, here are some numbers to make things clearer:
then you could take it further by adding some parameters to the curve (eg a + bx + cx^2) that the user can alter.
(actually, it can be more general – it can have multiple peaks or go black at bright points – there’s an ansel adams image with a black sun, for example. the idea’s the same, just use a higher order polynomial, or change the sign of the parameters above – a -ve c will make bright areas dark. and you can use splines rather than polynomials. basically, it’s a mapping from input to output that goes “up and down” and within that there’s a lot of flexibility…).