Hades logo    Hades applet banner

TAMS / Java / Hades / applets (print version): contents | previous | next

Gamma correction

Gamma correction screenshot


A demonstration of contrast and brightness manipulation using the GammaFilter component. The filter uses three parameters:

It then applies the following formula to each color component (red, green, blue) at each image pixel:

value = k * (rgb - b)^(gamma)

Note that the pixel values (rgb and b) are used as integers in the interval [0 .. 255] instead of prescaling them to the [0 .. 1] interval. Typical (useful) ranges are k=[-1.0 .. 2.0], gamma=[0.0 .. 3.0] and b=[-100 .. 100].

Obviously, setting k=1.0, b=0, and gamma=1.0 results in the identity transformation. If you set gamma=1.0, you can change the image contrast and brightness linearly via the k contrast and b offset parameters, while a gamma value unequal to 1.0 results in a non-linear transformation.

Run the applet | Run the editor (via Webstart)

Impressum | 24.11.06