Home | Lehre | Videos | Texte | Vorträge | Software | Person | Impressum, Datenschutzerklärung |
Store colors pixel by pixel:
1 bit: black and white
8 bit grayscale
8 bit color palette (used 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 proprietary “raw” formats of digital cameras
...
Such files can get pretty big: 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 (blocks of 8x8 pixels, DCT base patterns)
LZW coding in GIF and TIFF: collect an alphabet of frequent color sequences
A number of hopefully patent-free techniques in PNG
Wavelet compression in JPEG 2000 aka JP2 (Daubechies wavelet)
...
Simple bitmap operations with .NET
Plug-ins for Paint.NET (see example code for today)
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 negative or above 255.
Endless other possibilities: warping, simulation of oil paint, hair growth, ...
Aliasing: generation 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 seemingly 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 shifted filters for each R, G, and B subpixel, thus achieving a higher spatial resolution.
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)