Home | Lehre | Videos | Texte | Vorträge | Software | Person | Impressum, Datenschutzerklärung | Blog
Bitmap Graphics
Formats
Store colors pixel by pixel. How? -> Color Models:
-
1 bit: black and white
-
8 bit grayscale
-
8 bit color palette (used promently for GIF)
-
24 bit color (standard)
-
48 bit color
-
floating-point formats (high dynamic range, HDR)
-
an image sensor's raw data in the color filter pattern: the "raw"
formats of cameras
-
...
This gets pretty big pretty fast (size in bytes = width * height * bytes
per pixel). Thus, one needs compression techniques:
-
run-length encoding (RLE) in 8-bit BMP
-
DCT and entropy coding in JPEG (8x8 blocks, DCT base patterns)
-
LZW coding in GIF and TIFF
-
a number of strategies in PNG
-
wavelet compression in JPEG-2000 (Daubechies wavelet)
-
...
Programming
Basic Effects
-
Per-pixel effects: Take the color of every single pixel and compute a new
color from it, for instance to change the brightness or to turn blueish
tones into greenish ones.
-
Convolution [German: "Faltung"]: For every pixel look at its neighbors;
form a new color by summing up fixed (possibly negative) multiples of these
colors. The numbers representing the multiples form the "convolution kernel"
[German: Faltungskern], which is written as a matrix. Blur effects and
standard sharpen effects (in particular, unsharp masking) and relief effects
are examples of this kind of filter. Note that may of these effects require
"clamping" the results to the 0...255 range, as they may return values
that are negtive or above 255.
-
Endless other possibilities: warping, simulation of oil paint, ...
Antialiasing
Aliasing: creation of spurious frequencies due to sampling of frequencies
of half the sampling rate or more. Note that "frequency" may also mean
lines per inch, not only periods per second. This occurs in:
-
Images: moiré patterns, in particular when scanning photographs
from journals; jaggies along lines
-
Films: wheels seeminly turning in the wrong direction
-
Sounds: unharmonic, harsh timbre
There is a huge variety of countermeasures, all called "antialiasing".
The basic approach is to limit the range of frequencies before sampling.
It is virtually impossible to filter after aliasing has been created; one
has to filter before sampling at the intended sampling rate. One simple
approach to this is supersampling: Sample at several times the intended
rate, then filter digitally and resample digitally at the intended rate.
This is employed for images, films, and audio all alike.
The filtering leads to smooth transitions as can be seen in antialiased
font rendering. Note that Microsoft's ClearType applies different filters
for each R, G, and B subpixel, thus achieving a higher spatial resolution.
Interpolation
Another issue related to the discreteness of the pixels is interpolation:
To compute arbitrarily scaled, rotated or warped versions of an image,
one has to determine color values "between" the pixels of the given image.
Standard interpolation methods:
-
nearest neighbor: take the color of the nearest pixel
-
bilinear interpolation: blend the colors of the four nearest pixels
-
bicubic interpolation: blend the colors of the sixteen nearest pixels using
a cubic function that determines the percentages
-
sinc interpolation (sinc = cardinal sine): theoretically perfect, takes
infinitely many pixels into account (and thus cannot be realized precisely)