CoastWatch UNESCO Bilko Project Module 7
Caribbean Regional Node

Information | Data | Software | Sites | Feedback | News


Bilko4.pdfPart 4
Part1 | Part2 | Part3 | Part5

Introduction to the Bilko for Windows 2.0
image processing software
 

9. Image menu

The Image menu initially offers two options:

Once images are "connected", a range of further options become available including powerful manipulations of the images using Formula documents (see next section), the making of colour composite images, etc.  
Activity: Open both the EIRE4.BMP and EIRE2.BMP images. Select the Connect... option from the Image menu and holding down the <CTRL> key click on the image file names displayed in the Connect dialog box (i.e. eire2.bmp and eire4.bmp) to ensure that both are highlighted. Then click on  to connect the two images.
A pair of boxes like those to the right, but without any numbers, appears in the workspace. The two buttons are to allow you i) to refer to the two images in formulae, and ii) to control which guns (red, green or blue) on your computer monitor display which images when making colour composite images (see Part 5). Make EIRE2.BMP image 1, by clicking the button corresponding to its position in the pair of connected images. Thus, if it is on the left of the pair click on the left button first. A red `1' appears on the button you click first. Then click the other button so that EIRE4.BMP becomes image 2.
 
The Image menu now offers more options: The NDVI is described below and colour composites and output options are discussed in Part 5. At this stage it is enough to know that these facilities exist. However, you will now briefly explore the use of Formula documents and Filters in the next two sections.

The NDVI (Normalised Difference Vegetation Index) option calculates the NDVI of two images using the following formula (for 8-bit images), where Image 1 is a near infra-red image and Image 2 is an image in the visible red waveband:

Note: the operation `image 1 - image 2' subtracts the DN of each pixel in image 2 from the DN of the corresponding pixel in image 1.

This option will be dealt with in a specific lesson dealing with images taken in these wavebands. It will not be considered further in this Introduction.


10. Formula documents

Once two or more images have been `connected' they can have arithmetic performed on them using instructions typed into a Formula Document. These arithmetical manipulations allow specific features of interest in the images to be enhanced or investigated using data from several images at once. These might be images of a given area in one waveband taken at different times, or images in several different wavebands of the same area.

As an exercise to demonstrate how Formula documents work we will create a `mask' using EIRE2.BMP and apply this to EIRE4.BMP to make an image which has all the land with a DN of 0, but has all the sea with the values originally recorded in EIRE4.BMP.

The first step is to create a `mask' from EIRE2.BMP which has all sea pixels with a DN of 1, and all land pixels with a DN of 0. If you explore EIRE2.BMP using the cursor and the zoom facility you will find that almost all sea and lake pixels have a DN of 0 but that some in narrow channels (e.g. in the sound between Islay (Figure 1) and the island of Jura to the east) and close to coasts have DN values up to 45. Land pixels, however, tend to have DN values in excess of 90. To make sure all the sea values are consistently 0 we will firstly divide the image (i.e. will divide the DN of each pixel in the image) by twice 45 plus 1. This ensures that all pixels with values of 45 or less will become 0 (when the result of the division is rounded to the nearest positive integer). Thus 45/91=0.4945 which to the nearest integer is 0, whilst 46/91=0.5055 which to the nearest ineteger is 1. Having done this all sea areas will have a DN of 0 and all land areas will have a DN of 1 or more. If we multiply the image by -1, all land areas will take on negative values but sea areas will remain 0. If we then add 1 to the image, the sea areas will have a DN of 1 whilst the land areas will have DNs of 0 or less which will display as 0 since we can only have DN values between 0 and 255 in an image.

Before we open the Formula document, note that in formulae you refer to images by the @ sign followed by their number on the connect buttons. Thus in this case EIRE2.BMP is image @1 and EIRE4.BMP is image @2.

Activity: Select File, New and in the New dialog box select FORMULA Document. A blank window opens into which you type your formula. In this instance the formula we want to create the mask is:

@1/91*-1+1;

This takes EIRE2.BMP (@1) divides it by 91, multiplies it by -1, and then adds 1 to the resultant image. Note that the formula must finish with a semi-colon (;).

To apply the formula, click on the copy button, then click on the connected images and click on the paste button. A Status dialog box will appear which indicates that the formula is being applied. When the image arithmetic is completed a new image will appear which contains the results of the manipulation. In this case the image will appear completely black because pixels have DN values of either 0 or 1. To see the mask clearly, perform an automatic linear stretch. This maps all the sea pixels with DN 1 to a display scale DN of 255 so that land appears black and sea appears white. Use the cursor in conjunction with the Status Bar to check that the mask's pixel values are either 0 or 1. Your mask should look like the image below.

If this mask is applied to another image by multiplying that image by it, it will cause all land pixels to become zero. However, it will not affect sea pixels because it just multiplies them by one. Having looked at the mask image, close it.

The next step is to edit the formula so as to multiply EIRE4.BMP (@2) by the mask. You will now need some parentheses in the formula to make sure the operations are carried out in the correct sequence. Return to you Formula document and edit the formula until it is exactly as below:

(@1/91*-1+1)*@2;

The mask will now be applied to EIRE4.BMP creating an image whose land pixels actually have a DN of 0, rather than just being displayed as such. Copy the Formula document, click on the connected images and paste the formula. The resultant image is similar to EIRE4.BMP but has all the land black. Use the cursor to verify that land pixels are indeed all zero in value whilst the sea pixels are unchanged. Close the Formula document and the new image as they are not required later.
 

 
11. Scattergram option Activity: Click on the pair of connected images (EIRE2.BMP and EIRE4.BMP) and press <CTRL>+A to select all the images. Select New from the File menu and note that a new type of document, the Scatter document is listed in the New dialog box. Select SCATTER Document and click on  to display a scattergram which is a plot of the DN values of each pixel in EIRE2.BMP (image 1, x-axis) against its DN value in EIRE4.BMP (image 2, y-axis). Note that there is an inverse relationship between pixel DN values in the two images. Thus pixels with a high DN in EIRE4 have a low DN in EIRE2, whilst those with a low DN in EIRE4 tend to have a high DN in EIRE2.

Question 5: Which pixels are in which of the above categories, and why is there this inverse relationship? Answers

Activity: Close the scattergram, the connected pair of images and the EIRE2.BMP image. Do not close EIRE4.BMP as this is needed for the next exercise.

 
 

12. Filters

The Filter submenu of the Image menu allows the user to apply filtering processes to an image. Six predefined filters (Mean, Median, Laplace, Roberts, Sobel and Variance) are provided and users are also allowed to create their own customised filters. The first two predefined filters act to smooth the image and are sometimes called `low pass' filters. The middle three act to enhance edges or gradients (i.e. areas on the image where there are sudden changes in reflectance in a given waveband) and are sometimes called `high pass' filters. The predefined Variance filter is a textural filter which makes areas of changing reflectance appear brighter than relatively uniform areas which appear darker the more uniform they are.

The three predefined high pass filters all act on 3x3 groups of pixels whilst the Mean, Median and Variance filters can have their sizes altered in a Filter Sizes dialog box (right). By default these filters act on 3x3 groups of pixels (3 rows x 3 columns) and this setting is initially displayed. The maximum size allowed is 15x15 pixels.
 

Activity: Click on the EIRE4.BMP image, open the manual stretch saved as EIRE4.STR, and open the colour palette saved as EIRE4.PAL, in each case using the Open option in the File menu. The stretched coloured thematic image you created earlier should appear. Then use Edit, Select All or press <CTRL>+A to select the whole of this image for filtering. The first filter we will experiment with is a simple 3x3 Mean filter. This replaces the central pixel in each square of nine pixels by the mean of the nine pixels. This filter is a smoothing filter and will emphasise the major changes occurring in our thematic colour map of sea surface temperatures at the expense of localised differences.  

Activity: From the Image menu, select Filter, Mean with the mouse. The Filter Sizes dialog box will appear (see above). Since we want a 3x3 filter, just click on . A Status box briefly appears as the filtering is carried out and then a window containing the filtered image appears. Compare the filtered and unfiltered image. Note that the broad changes in water temperature are more clearly displayed in the smoothed image. You can see what you have done to the new smoothed image by clicking on the grey edge above the image [indicated by arrow] but below the title bar (when you are in the correct position the mouse pointer changes into black upward and downward arrows emanating from a pair of parallel lines) and dragging this window pane downwards (it works a bit like a roller blind). Underneath the image you should see 3x3 Mean Filter over EIRE4.BMP : From (0, 0) To (512, 256).  
 
The larger the array used for filtering the harsher the smoothing filter will be. To see the effect of a large smoothing filter we will experiment with a 7x7 Mean filter which replaces the central pixel in a 7x7 pixel array by the mean of all 49 pixels in the array. As you can imagine, such a filter, although bringing out large scale features, can cause considerable loss of detail. Activity: Click on the EIRE4.BMP unfiltered image. From the Image menu, select Filter, Mean with the mouse. The Filter Sizes dialog box will appear (see above). Click on the down arrows by the Rows: and Cols: boxes and select 7 for each (or type 7 in each box), then click on . A Status box briefly appears as the filtering is carried out and then a window containing the filtered image appears. Compare this image both with your original unfiltered image and the image filtered with a 3x3 Mean filter. Note how Malin Head and some small islands have almost disappeared and the rather cartoon like quality of the heavily smoothed image. This illustrates the care which one must take using such filters. Close the two filtered images (do not save changes).  
 
The Median filter acts in a similar fashion to the Mean filter but replaces each pixel value by the median of the group of 3x3 pixels of which it is the centre.

We will now look at the effects of a `high pass', edge enhancing filter. We could use the Laplace, Roberts, or Sobel filters, but will use the Sobel. Details of the different filters is available via on-line Help.

Activity: Close the stretched and coloured EIRE4.BMP image and open the original EIRE4.BMP image again. Press <CTRL>+A to select the whole of this image and carry out an Auto Linear stretch. Finally apply the Sobel filter to the image. The boundary between land and water areas is very bright and sharp, and temperature gradients within the sea itself are also visible as brighter lines, though these are much fainter than the land/water boundaries. Note, particularly, the thermal gradient associated with the front lying off the north-east coast of Northern Ireland.

Close the filtered image.

The Variance filter replaces each pixel value by the variance of the group of nxn pixels (default 3x3 pixels) of which it is the centre. Its use is demonstrated in specific lessons but will not be considered further in this Introduction.

The Image, Filter, Custom option allows a Custom filter to be constructed in which the weights (integers) for each cell in the filter array are defined by the user. We will experiment with constructing a few 3x3 filters to carry out specific modifications to an image. Firstly, we will construct a simple mean filter for smoothing, and then three different edge-enhancing, high pass filters. Details of precisely how these convolution filters work are beyond the scope of this Introduction but are covered in standard textbooks.
 

 
Activity: Experiment by constructing your own filters. To start let us try out constructing a mean filter or smoothing filter. This filter will replace the middle pixel in a 3 pixel x 3 pixel block with the mean of the 9 pixels in the block. Firstly, in order to see exactly what it does, use the cursor to make a note of the underlying pixel values in EIRE4.BMP surrounding the pixel at (x, y) co-ordinates (174, 64). Click on the No selection button (see right) and use Edit, Go To... to put the cursor straight on the pixel.

Write the original underlying pixel values (in the second to last panel on the Status Bar) in the 5x5 table below (left). When you are on the correct central pixel, the Status Bar at the right bottom edge of the UNESCO Bilko window should look as follows:


 
1
1
1
1
1
1
1
1
1
Now select the Filter, Custom option from the Image menu. This brings up a Filter document like that on the previous page with a 3x3 array with all cells set to 0. To move between each cell in the filter you use the <TAB> key. Enter a 1 in the first cell and then move to each cell in turn inserting a 1 until the filter looks like the example to the right. This filter gives all pixels in the array equal weight in the averaging process. To apply the filter click on the copy button on the toolbar, then click on the EIRE4.BMP image and click on the paste button on the toolbar. A Status box will appear briefly indicating progrees of the filtering operation and then the filtered image is displayed in a window.

Note the smoothing that has occurred which makes the filtered image look slightly blurred compared to the unfiltered original. Now use the cursor to discover how the central 9 pixels from coordinates (173, 63) to (175, 65) have changed. Enter these values in the 3x3 table above and check that the central pixel is indeed the mean of the nine pixel block of which it is the centre. When you have finished, close the filtered image using its Control box.

Below are three other filters with which to experiment. In each case, edit the Filter document to insert the new cell values, and then copy and paste the new filter to the EIRE4.BMP image. [Note: you can also drag-and-drop filters onto images.]

The first is a general high-pass (mean difference) filter which enhances all sharp features or edges in the image. Having applied this to the EIRE4.BMP image, answer the following question. Question 6: What are the principal sharp features which the high-pass (mean difference) filter enhances on the EIRE4.BMP image? Answers

The second is a filter designed to enhance linear features running in an E-W direction. Examination of EIRE4.BMP indicates that many geological features actually run in a SW-NE direction (e.g. the Great Glen); the third filter is designed to enhance such features.

Activity: Try these two filters out. Compare the images produced by the different filters. For the SW-NE edge enhancer, note the bright bands along the north-western sides of SW-NE linear features and the dark bands along the south-eastern sides of such features.

When you have finished, close all documents and then close UNESCO Bilko using File, Exit unless you are continuing on to the advanced options in Part 5.
 
 

 
Answers to Questions - Part 4

Question 5

Pixels with a high DN in EIRE4 but low DN in EIRE2 are sea pixels which absorb near infra-red wavelengths and are thus very dark on EIRE2 but are relatively bright (cool) on the thermal infra-red EIRE4 image. Pixels with a low DN in EIRE4 but high DN in EIRE2 are lowland land pixels which are relatively warm and thus dark in the thermal infra-red EIRE4 image but well vegetated and thus relatively reflective and bright in the near infra-red EIRE2 image. Thus areas which tend to be bright in one image tend to be dark in the other. Highland land areas and lakes provide intermediate values.

Question 6

Coastlines (land/water boundaries) and the oceanic front north-east of Malin Head.
 

Part of EIRE4.BMP before and after filtering with a simple 3x3 mean filter (see section 12).


^ Back to main page Back to Educational Res. USDOC | NOAA | NESDIS | CoastWatch