Interpolation (photography)
In digital photography, interpolation (literal translation: "intermediate calculation") describes a process for generating image content
- between different pixels of an image (density interpolation)
- within individual pixels (color interpolation).
Interpolation is a necessary part of the signal processing path of digital images, as all changes to the amount of pixels and the color can only be realized with this. In the entire processing path between image generation and display, multiple interpolations are made - this always results in a loss of sharpness .
Basics
Each pixel transports image information in two ways:
- In interaction with other pixels (only all pixels together result in an image). This is represented by the point density .
- Inside the pixel (brightness & color). This is represented by the color depth .
In every image processing chain (example: camera - screen - memory - printer) the dot density and color of each image are changed several times. That is u. a. necessary due to the adaptation of the image to the image-presenting medium . Typical for this are the differences between screen and printer, as both require special point densities and use different color spaces .
By means of interpolation, the number of pixels is increased or decreased by the desired value, and the new color value is determined in the event of color and brightness changes. This intermediate calculation does not result in any new image information, but only intermediate values based on the original information.
Density interpolation
The number of pixels in all digital images must be changed several times. As an example, this can be seen in the fish picture opposite:
- the original image is 800 × 300 pixels
- In the representation of an average Internet browser , this image is currently displayed with approx. 216 × 82 pixels
- a printout 20 cm wide at 300 dpi , on the other hand, would require a quantity of 2362 × 886 pixels.
The decrease or increase in the amount of pixels is achieved by interpolation.
The fish in the sample picture consists of 25 × 20 squares. What would the density interpolation look like on 17 × 13 squares or on 27 × 21 squares? These non-integer intermediate calculations represent the core problem of all interpolations and are the cause of various interpolation methods.
Color interpolation
The color and brightness information of pixels are stored together in the color depth of an image. In the image processing chain, the color information of a digital image is changed several times (within the color depth). This can be seen again in the example of the fish picture opposite:
- if the fish image is printed, the color of the printout always looks different from the display of the color on the screen
- each screen displays (at least slightly) the color of the fish image differently than another screen
A digitally photographed image is usually processed with 3 color channels in red, green and blue . In the most common case, each color channel has 256 gradations (= 8 bit). What would a color change in the fish image look like, for example halving the brightness?
- the light blue background has a cyan value of 206; halving is 103
- the blue fish has a blue value of 255; halving is not possible here, since the color channels only allow integer gradations. It depends on the interpolation method used which new blue value is available after the change in brightness.
The color spectrum of the photo on the left comprises approx. 200 levels (so the color depth of 256 levels is not fully used). In the photo on the right, a simple contrast increase was carried out, which raised the color spectrum of the photo to 256 levels (= tonal value spread ). The before-200 levels cannot be transferred identically to after-256 levels . The specific color values are determined by the interpolation method. The gaps in the color spectrum (caused by this change) are symbolized by a gaps in the display in the histogram (diagram below the photo).
Interpolation methods
From a mathematical point of view, interpolation means " intermediate value determination ". The new values are calculated from the known pixel values of an image using interpolation algorithms. The main difference between the various interpolation methods lies in the evaluation of the known pixel values and the resulting definition of the new image content. The common feature of all interpolation methods is the effect on the content of point density and color depth.
Multiple interpolations are often used in every image processing chain. There are always non-integer changes. This type of change results in a loss of information and thus a loss of sharpness . Due to this system-related loss of sharpness, the influence on the impression of sharpness always dominates when choosing the interpolation method .
The impression of sharpness determines the choice of interpolation method :
two versions of a face can be seen in the middle. Most viewers perceive the photo on the right as being more sharp (because it has more contrast).
In the enlargements (outside) it can be clearly seen that the left picture contains more sharpness (= more richness of detail). Sharpness and the impression of sharpness are two different things.
Typical interpolation methods are pixel repetition, bilinear interpolation, and bicubic interpolation. These are based on the method of a reconstruction filter .
Pixel repetition
With pixel repetition, also called nearest neighbor , the color value of the closest pixel of the input image is assigned to each pixel of the output image. Decreasing point densities or making non-integer changes will erase some of the existing pixel values. Shrinking images with this method can lead to severe aliasing , which manifests itself as image artifacts. When enlarging by means of pixel repetition, there is a block-like, "pixelated" representation.
Bilinear interpolation
With bilinear interpolation , the color value of a pixel in the output image is interpolated from the four neighboring color values in the input image. When reducing point densities or non-integer changes, simple value trends (example: strong changes in brightness) are taken into account.
Bicubic interpolation
This method uses analytical functions (i.e. the consideration of tendencies beyond the neighboring pixels) for the recalculation. A color value of the output image is interpolated from the neighboring color values of the input image by means of cubic splines . There are several common cubic splines with different properties; the term “bicubic interpolation” is therefore ambiguous. With the reduction of point densities or non-integer changes, significantly “softer” transitions between the new pixels arise than with simple pixel repetition.
The image processing program GIMP (version 2.7) uses Catmull-Rom splines. With this spline type, the color values at edges overshoot , which manifests itself as a sharpening of the image. The image processing program Paint.NET (version 3.36), on the other hand, uses cubic B-splines, which lead to a more blurred representation.
Compare different interpolation methods
Comparison with density interpolations
Enlargement by reconstruction with a separable Catmull-Rom filter ( bicubic interpolation )
Enlargement by reconstruction with a separable cubic B-spline filter ( bicubic interpolation )
Comparison with color interpolations
The bicubic interpolation of the original file - the softer transitions are clearly visible.
I.a. This also results in a change within the color depth (see histogram in the middle) - the bicubically interpolated image contains significantly fewer gaps in the tonal value distribution than the image interpolated through pixel repetition.
Web links
- Image processing in practice by Rainer Steinbrecher in the 2nd revised edition as a download version (PDF 6.1 MB) (1st edition: ISBN 3-486-22372-0 ) - u. a. Chapter "Image Enhancement" p. 122