Image filtering : Fundamentals

Answers to the processing applications

1. Read and display image moon.tif in gray-levels. What is the image format? How many quantization levels are used to represent this image?


   
    Figure C1: Display of the original image
Figure C1: Display of the original image [zoom...]Info

moon.tif corresponds to a gray-level monochrome image. The minimum and maximum values are 0 and 253. The pixels are therefore quantized on 8 bits. It is not an indexed image since the color table is empty.

2. Modify the pixel values of image moon.tif to display it as a negative image.

A simple method is to create a uniform matrix y of same dimension as x, whose pixels are equal to 255. We then compute the difference between y and x, and display the result.


   
     Figure C2 : display of the negative image.
Figure C2 : display of the negative image. [zoom...]Info

The difference can only be computed after conversion of the images from their original format uint8 to the format double. The output image then needs to be back-converted to uint8 before being displayed.

3.Filtering. We consider the following bidimensionnal separable filter h(5,5):

Filter creation:

Display the frequency response (in magnitude) of this filter.

>> freqz2(h)


   
     Figure C3 : Frequency response of filter h.
Figure C3 : Frequency response of filter h. [zoom...]Info

The frequency response of h is maximum at zero frequency (i.e. at the frequency origin). It is therefore a low-pass filter.

Filter image moon.tif by computing the convolution product with h(5,5) and display the result.


   
     Figure C4: Image moon.tif filtered with h
Figure C4: Image moon.tif filtered with h [zoom...]Info

We now consider the filter g:

Display its frequency response:

>> freqz2(g)


   
     Figure C5 : Réponse en fréquence du filtre g
Figure C5 : Réponse en fréquence du filtre g [zoom...]Info

and apply the filter to the output image from the last step.


   
     Figure C6 : image moon.tif filtered successively with h and g
Figure C6 : image moon.tif filtered successively with h and g [zoom...]Info

4. What conclusion can we draw from this last point?

We observe that the details and more particularly the crater contours have been highlighted by this later filtering, while they had been attenuated by the first filtering.

This example illustrates a technique used in image enhancement called « unsharp masking ».    

AccueilOutils transversesNouvelle pageInformations sur le cours (ouvrir dans une nouvelle fenêtre)Answers to the processing applicationsExercises