May 27, 2004

Contents

Flatten Illumination

(Background Subtraction)

When the illumination level or backtround brightness level varies over the image, the contrast cannot be increased without loosing image information.

This example shows the specific steps taken in the Flatten Illumination Demonstration, and illustrates image transposition, image smoothing, image arithmetic, and multiple intensity profiles. Although this image is not a micrograph, it has a large gradient in illumination or background intensity that sometimes plagues micrographs. The slowly varying background can be removed either by subtracting a filtered image (containing only background 'information') from the original and enhancing the contrast (done here), or by high pass filtering to remove the slowly varying gray level information using the FFT - see FFT flattenship exercise.  (How to flatten using Lispix).

The object is to enhance the image to clearly show how the wooden planks are fitted together.


The Problem

This is how the image looks as loaded. The Process... -> Enhance Contrast menu does not enhance much (try it) because the image already has a full range of brightnesses. Inspite of this wide brightness range, it appears washed out because of the low relative contrast in any particular part of the image.

The center part of the image does have increased contrast, but the top and bottom are saturated white or black.

 

 


 

The solution

The smooth brightness gradient can be considered as background, which should be subtracted out. To generate an image with only this gradient - a mean filter with a large kernel size.

The Process -> Enhance Contrast menu has been used to better show the detail of the image below - it has no effect on subsequent operations because only the LUT is changed - not the pixel values.  Not necessary in ImageJ.

The convolution operations leave a border of the image untouched. This border has a width of half the kernel size and corresponds to areas of the image where some of the kernel has no data. ImageJ uses modified kernelsto smooth the border..

The smoothed area of the image in the center has no fine detail. Therefore, the detail will not be subtracted out of the original in this area.

Image, Scion Image

ImageJ

 

 

 

The following steps subtract the smoothed image from the original, then enhance the contrast. In ImageJ, use Process / Subtract Background, and set the radius of the rolling ball to somewhere between 50 and 100.  I used a radius of 64.  This replaces all of the following steps.

 

This differenct image, of course, has less contrast than the original. However, since the image has been flattened in terms of brightness levels, the contrast can be enhanced to give the desired result, below.

The image has positive and negative values, with the light gray in the border representing zero (the border was not changed by the mean filter, so here, the image was subtracted from itself.) The border does not appear black because there are values less than zero in the image that appear darker. There is no border with ImageJ / Process / Subtract Background. (The final image is rescaled by Image to have values 0 - 255).

(If the Scale Math button in the Paste control window was checked, the border will have some image data in it, which you can ignore. The central part of the image should still be enhanceable.)

 

Result after using the Process -> Enhance Contrast menu.

(Compare with image flattened with low pass filtering, FFT, Flattenship exercise).

 

Image

.

ImageJ

To make the changes 'permanent', use the Process -> Apply LUT menu (Apply button in the B&C window) , which will change the image pixel values, and restore the LUT to the original ramp.


About the Photograph:

Courtesy of John Broadwater, 1994, personal communication. See National Geographic 173(6) pp. 804-823 (June 1988).

This is an underwater photograph of the inside of the hull of the Betsy, a British troop carrying vessel in the American Revolutionary War. General Cornwallis sank this boat along with others off the coast of Norfolk in order to block it from reinforcements. He planned to retrieve the vessels after winning the war.

A diver took the photograph holding a flash above his head, therefore more scattered light and more scatter toward the top of the image.