Microscopy Primer
Light and Color
Microscope Basics
Special Techniques
Digital Imaging
Confocal Microscopy
Live-Cell Imaging
Photomicrography
Microscopy Museum
Virtual Microscopy
Fluorescence
Web Resources
License Info
Image Use
Custom Photos
Partners
Site Info
Contact Us
Publications
Home

The Galleries:

Photo Gallery
Silicon Zoo
Pharmaceuticals
Chip Shots
Phytochemicals
DNA Gallery
Microscapes
Vitamins
Amino Acids
Birthstones
Religion Collection
Pesticides
BeerShots
Cocktail Collection
Screen Savers
Win Wallpaper
Mac Wallpaper
Movie Gallery

Interactive Java Tutorials

Digital Image Warping

Geometrical distortion of objects appearing in a digital image can take various forms. One algorithm that can correct certain types of geometric distortion in digital images is the geometrical warping transformation algorithm.

Interactive Java Tutorial
ATTENTION
Our servers have detected that your web browser does not have the Java Virtual Machine installed or it is not functioning properly. Please install this software in order to view our interactive Java tutorials. You may download the necessary software by clicking on the "Get It Now" button below.

 

This interactive tutorial explores geometrical warping algorithms for correcting certain types of distortion in digital images. The tutorial initializes with a randomly selected specimen image appearing in the left-hand window entitled Source Image. Adjacent to the Source Image window is a Destination Image window that displays a warped projection of the captured image. To operate the tutorial, select an image from the Choose an Image pull-down menu. The yellow quadrilaterals in each window control the operation of the warping transformation. To adjust the shape of the yellow quadrilaterals in either window, drag and drop any of their control points to a position within the same window. The control points are the small blue circles that form the vertices of the quadrilateral. To move a control quadrilateral, drag and drop it to another position in the same window. The control quadrilaterals may also be rotated by clicking and dragging the mouse along their outer boundaries. Whenever a quadrilateral is changed, the Destination Image will be recomputed and redisplayed automatically. The warped image will be constructed from the Source Image according to the shapes and positions of the yellow control quadrilaterals. Visitors should examine the appearance of the Destination Image while reshaping the quadrilaterals in both the Source Image and Destination Image windows.

Geometric warping is a useful technique for removing some types of regularly occuring distortion from images in several specialized areas of digital micrography and imaging. For example, trapezoidal distortion is often encountered in scanning electron microsope imaging, where the specimen is often tilted to enhance the contrast in the captured image. This situation is not often encountered in light microscopy since the depth of field is typically so low that specimens must be flat and normal to the optical axis for proper imaging. This situation does arise, however, in the case of aligning serial section images, where foreshortening in sliced biological specimens can range from 5 to 15% in the direction of cutting due to the compression of the specimen by the cutting knife.

The type of geometric warping demonstrated in this tutorial is a projective mapping of a quadrilateral into a quadrilateral. This type of warping is useful for correcting the trapezoidal distortion, foreshortening, and alignment defects described above. This method is not suitable for correcting curvature defects of the imaging system, however, for which higher order warping is required. The general form of a projective mapping is a rational linear mapping. The relationship between source and destination space is given by the following equations:

(1)

(2)

where x and y represent the coordinates of a point in the source image, and u and v represent the coordinates of a point in the destination image. The coefficients a, b, c, d, e, f, g, and h (i represents a homogeneous coordinate and is commonly set to 1) in the equations above can be obtained by solving the following system of linear equations:

In the matrix equation above, (xi, yi), i = 0, 1, 2, 3, represent the coordinates of the control points of the source quadrilateral, and (ui, vi), i = 0, 1, 2, 3, represent the coordinates of the control points of the destination quadrilateral. The solution of this system of equations requires the inversion of an 8 x 8 matrix, which can substantially increase the amount of programming effort required for an application that uses this method. With a CPU that provides adequate floating point performance, this method has the advantage of allowing for real-time computational performance.

When this system of linear equations is solved, the address of a pixel contained within the quadrilateral of the Source Image may be computed for each pixel in the Destination Image using equations (1) and (2) above. Unfortunately, the calculated coordinates for the location of the pixel in the source image will only rarely be integers. The result is that the calculated pixel location often lies in an area between a group of pixels in the source image. Several methods are available to deal with this problem. The simplest approach is the nearest neighbor algorithm, which operates by truncating the calculated coordinates so that the fractional part of the address is discarded. Another very similar approach is to round the calculated coordinate values to the nearest integer value. Either method introduces a small degree of error that will slightly distort the destination image. In some cases this distortion is acceptable, but better results can usually be obtained by interpolating brightness values over a small neighborhood of pixels at the expense of more detailed computations. The method of bilinear interpolation employs a four-pixel neighborhood (2 x 2 array) surrounding the calculated address to obtain a new transformed pixel value. In the tutorial, the intensity values of the pixels in the Destination Image are computed using the nearest neighbor algorithm by default. Included in the tutorial is an option to apply bilinear interpolation (the Bilinear Interpolation checkbox) to the warped image instead of the nearest neighbor algorithm. Checking this option will make the warped Destination Image appear smoother, improving the visual quality of the resulting image.

BACK TO DIGITAL IMAGE PROCESSING TUTORIALS

Questions or comments? Send us an email.
Text and graphics for this interactive tutorial are
© 2000-2025 by Kenneth R. Spring and Michael W. Davidson.
All Rights Reserved.
© 1998-2025 by Michael W. Davidson and The Florida State University. All Rights Reserved. No images, graphics, scripts, or applets may be reproduced or used in any manner without permission from the copyright holders. Use of this website means you agree to all of the Legal Terms and Conditions set forth by the owners.
This website is maintained by our
Graphics & Web Programming Team
in collaboration with Optical Microscopy at the
National High Magnetic Field Laboratory.
Last modification: Friday, Nov 13, 2015 at 02:19 PM
Access Count Since March 1, 2001: 3874
Visit the websites of our partners in digital imaging education:
Visit the Olympus Microscopy Resource Center website. Visit the QImaging website.