Chapter 4

 

Home Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5.1 Chapter 6 Chapter 12 Chapter 13 Chapter 14

Chapter 4: Image Pre-processing

Overview: 
4.1    Pixel Brightness Transformations
4.2    Geometric Transformations
4.3    Local Pre-processing
4.4    Image Restoration

4.0 Overview

Pre-processing is a common name for operations with images at the lowest level of abstraction -- both input and output are intensity images.

The aim of pre-processing is an improvement of the image data that suppresses unwanted distortions or enhances some image features important for further processing. 

Four categories of image pre-processing methods according to the size of the pixel neighborhood that is used for the calculation of a new pixel brightness: 

pixel brightness transformations, 
geometric transformations, 
pre-processing methods that use a local neighborhood of the processed pixel 
image restoration that requires knowledge about the entire image. 
Image pre-processing methods use the considerable redundancy in images. Neighboring pixels corresponding to one object in real images have essentially the same or similar brightness value. Thus, distorted pixel can often be restored as an average value of neighboring pixels. One example of this is filtering impulse noise. 
If pre-processing aims to correct some degradation in the image, the nature of a priori information is important: knowledge about the nature of the degradation; knowledge about the properties of the image acquisition device, and conditions under which the image was
obtained. The nature of noise (usually its spectral characteristics) is sometimes known. 
knowledge about objects that are searched for in the image. 
If knowledge about objects is not available in advance it can be estimated during the processing. 

4.1    Pixel brightness transformations 

Brightness transformations modify pixel brightness -- the transformation depends on the properties of a pixel itself. Two classes of brightness corrections: position dependent and gray-scale transformations.
position dependent brightness correction considers original brightness  and the pixel position in the image. 
Gray scale transformations change brightness without regard to position in the image. 
Position dependent brightness correction 
Ideally, the sensitivity of image acquisition and digitization devices should not depend on position in the image, but this assumption is not valid in many practical cases. 
Sources of degradation:  Uneven sensitivity of light sensors and Uneven object illumination
Systematic degradation can be suppressed by brightness correction.
Let a multiplicative error coefficient e(i,j) describe the change from the ideal image to the actual  image; 


where g(i,j) is the original undegraded image (or desired image), f(i,j) is the image containing degradation. 

If a reference image g(i,j) is known (e.g., constant brightness c) the degraded result is fc(i,j) systematic brightness errors can be suppressed: 

For this process to work, Image degradation process must be stable, the device should be calibrated time to time (find error coefficients e(i,j)) 

This method implicitly assumes linearity of the transformation, which is not true in reality as the brightness scale is limited into some interval. Overflow is possible if errors are large. 

Grey scale transformation 
Grey scale transformations do not depend on the position of the pixel in the image. 
Brightness transform from a scale p to scale q

The figure below shows the most common transformations:

a - Negative transformation 
b - contrast enhancement (between p1 and p2) 
c - Brightness thresholding 
Grey scale transformations can be performed using look-up tables. 
Grey scale transformations are mostly used if the result is viewed by a human. 

histogram equalization tries to equally distributed brightness levels over the whole brightness scale 

Histogram Matching Algorithm
  1. For an NxM image with G gray-levels, create an array H with a length G initialized with zeros.
  2. Calculate the histogram of gray-levels for the image. Take each pixel and increment the element of H that corresponds to intensity level of the pixel. If the intensity level is g_p, then:  H[g_p]=H[g_p]+1
  3. Form the cumulative image histogram, H_c. The cumulative histogram tells you how many pixels have gray-levels less than or equal to the p-th gray-level. The calculation is: H_c[0]=H[0], then: H_c[p]=H_c[p-1]+H[p]. In Matlab, the command cumsum performs this calculation without the looping.
  4. Set the mapping between gray-levels as: q = T[p] = round((G-1) H_c[p] /(N M));
  5. Go through the image, pixel-by-pixel and write an output image with gray-levels g_q using the mapping from step 4.
 


Practical Experiment 4.A - Gray Level Mapping 

Read in and display the image what_is_it.jpg in Matlab using the command imagesc and a colormap of gray(256). Can you recognize the person? Man or a woman? 

Use the routine histeq and perform histogram equalization. 

>>y=histeq(whatisit);
» imshow(y)

Can you recognize the person now? Display the image histograms before and after equalization using the imhist  command in Matlab. 

4.2    Geometric transformations

Chapter 4.2 Topics: 
Pixel co-ordinate transformations 
Brightness interpolation
Geometric transforms permit the elimination of geometric distortion that occurs when an image is captured. 
An example is an attempt to match remotely sensed images of the same area taken after one year, when the more recent image was not taken from precisely the same position. 
To inspect changes over the year, it is necessary first to execute a geometric transformation, and then subtract one image from the other. 
A geometric transform is a vector function T that maps the pixel (x,y) to a new position (x',y').
The transformation equations are either known in advance or can be determined from known original and transformed images. Several pixels in both images with known correspondence are used to derive the unknown transformation. 
A geometric transform consists of two basic steps ... 
1. Determining the pixel co-ordinate transformation mapping of the co-ordinates of the input image pixel to the point in the output image. The output point co-ordinates should be computed as continuous values (real numbers) as the position does not necessarily match the digital grid after the transform. 
2. Finding the point in the digital raster which matches the transformed point and determining its brightness. Brightness is usually computed as an interpolation of the brightness of several points in the neighborhood
Typical geometric distortions which have to be overcome in remote sensing: distortion of the optical systems nonlinearities in row by row scanning and nonconstant sampling period.
Pixel co-ordinate transformations 
General case of finding the co-ordinates of a point in the output image after a geometric transform.  Usually approximated by a polynomial equation 
This transform is linear with respect to the coefficients ark, brk 
If enough pairs of corresponding points (x,y), (x',y') in both images are known, it is possible to determine ark, brk by solving a set of linear equations. 
More points than coefficients are usually used to improve the estimate of the coefficients. 
If the geometric transform does not change rapidly depending on position in the image, low order approximating polynomials, m=2 or m=3, are used, needing at least 6 or 10 pairs of corresponding points. The corresponding points should be distributed in the image in a way that can express the geometric transformation -usually they are spread uniformly. 
The higher the degree of the approximating polynomial, the more sensitive to the distribution of the pairs of corresponding points the geometric transform.
In practice, the geometric transform is often approximated by the bilinear transformation 
4 pairs of corresponding points are sufficient to find transformation coefficients 
Even simpler is the affine transformation for which three pairs of corresponding points are sufficient to find the coefficients

 

The affine transformation includes typical geometric transformations such as 
rotation, translation, scaling and skewing. 
A geometric transform applied to the whole image may change the co-ordinate system, and a Jacobean J provides information about how the co-ordinate system changes 
If the transformation is singular (has no inverse) then J=0. If the area of the image is invariant under the transformation then J=1. 
The Jacobean for the general bilinear transform  
The Jacobean for the affine transformation (4.12) 
Important  simple geometric transformations 
Translation - moving an object in the x and y directions
x' = x + dx
y ' = y + dy
J=1
Rotation - by the angle phi about the origin 
Change of scale - a in the x axis and b in the y axis 
Skewing by the angle phi 
 

Practical Experiment 4.B - Simple Geometric Transformations 

Open Matlab.  Load the image quarter.jpg.
Perform several geometric transforms by modifying the warping coefficients 
Perform translation, scaling, and skewing 

Complex geometric transformations (distortion) can be approximated by partitioning an image into smaller rectangular subimages; for each subimage, a simple geometric transformation, such as the affine, is estimated using pairs of corresponding pixels. 
geometric transformation (distortion) is then performed separately in each subimage. 
 
Brightness interpolation 
Assume that the planar transformation has been accomplished, and new point co-ordinates (x',y') were obtained. The position of the point does not in general fit the discrete raster of the output image. Values on the integer grid are needed. 
Each pixel value in the output image raster can be obtained by interpolating the some neighboring non-integer samples. 
The brightness interpolation problem is usually expressed in a dual way (by determining the brightness of the original point in the input image that corresponds to the point in the output image lying on the discrete raster). 
To get the brightness value of the point (x,y) the input image is resampled. 


fn(x,y) ... result of interpolation 
hn is the interpolation kernel 
Usually, a small neighborhood is used, outside which h_{n} is zero. 

Nearest neighbor interpolation assigns to the point (x,y) the brightness value of the nearest point g in the discrete raster 
Dashed lines show how the inverse planar transformation maps the raster of the output image into the input image - full lines show the raster of the input image. 
The position error of the nearest neighborhood interpolation is at most half a pixel. 
This error is perceptible on objects with straight line boundaries that may appear step-like after the transformation. 
Linear interpolation uses the four points neighboring the point (x,y), and assumes that the brightness function is linear in this neighborhood. 
Linear interpolation is given by the equation 
Linear interpolation can cause a small decrease in resolution and blurring due to its averaging nature. 
The problem of step like straight boundaries with the nearest neighborhood interpolation is reduced.
Bicubic interpolation 
improves the model of the brightness function by approximating it locally by a bicubic polynomial surface; sixteen neighboring points are used for interpolation. The interpolation kernel (`Mexican hat') is given by 
Bicubic interpolation does not suffer from the step-like boundary problem of nearest neighborhood interpolation, andcopes with linear interpolation blurring as well. 
Bicubic interpolation is often used in raster displays that enable zooming with respect to an arbitrary point -- if the nearest neighborhood method were used, areas of the same brightness would increase. 
Bicubic interpolation preserves fine details in the image very well.

Practical Experiment: Interpolation

Interpolation is used to approximate values of an image at integer intervals.

 

Chapter 4.3 Chapter 4.4

04/02/01