Lab Report PDF

Title Lab Report
Author Sarah Noonan
Course Digital Image Processing And Informatics
Institution Charles Sturt University
Pages 22
File Size 1.2 MB
File Type PDF
Total Downloads 66
Total Views 116

Summary

Image processing Lab report on x-ray images with noise removal and the use of median and averaging masks and band pass and notch filters...


Description

Image Processing Lab Report Charles Sturt University

Abstract Image processing is a technique that involves improving image quality in terms of contrast and visibility of small structures as well as removing noise and artefacts that occur in the digitization (data transmission) process. This particular report is based around discussing the use of a variety of masks and filters to improve image quality, such examples include median masks, averaging masks, band pass filters and notch filters. The first experiment based on noise removal uses median and averaging masks which act in the spatial domain to directly alter pixel values. These masks have their limitations however. Averaging masks result in blurring which becomes more prominent as the mask size is increased. Median masks perform particularly well on salt and pepper noise, but not very good on any other form of noise. The later experiment which looks at using band pass and notch filters to remove image artefacts, is carried out in the frequency domain. A variety of pass bands can be applied to an image to give varying results such as edge enhancement or reduction of small structures. Using a notch filter, by painting over certain frequencies, will supress that frequency so that they will not appear in the output image. The ideal band pass filter results in a ringing artefact in the spatial image so further alterations are needed to smooth this filter into a Gaussian profile. And notch filters, whilst removing unwanted frequencies, also remove some needed frequencies relating to spatial data, so a reduction in image quality is evident. In brief, digital imaging can result in loss of image quality, but also allows for correction of this with the application of masks and filters. (270 words)

Introduction A digital Image can be acquired directly as a digital image or it can be acquired as an analogue image and transferred to a digital image. In this transferring process, samples of data are taken in a raster fashion and the data is then quantized. This is where each analogue reading is assigned one of a finite set of pixel values which the monitor then displays in the output image (Burger, W. & Burge, M. J., 2009, p.7). Digital medical imaging allows images and patient information to be stored, copied and shared electronically, saving time, effort and space as well allowing for manipulation of image quality to improve diagnostic accuracy and reduce patient dose (Dougherty, G., 2011, p.10), for example, less exposure may be needed due to the ability to digitally manipulate contrast properties as well as the reduced need to repeat images (Honey, I. D., et al. 2005). To obtain the best quality images, Nyquist theorem states that an image should be sampled at a frequency that is at least twice the highest frequency contained in it. Under-sampling results in data being lost in transmission, whereas oversampled images don’t show a greater improvement as the system is limited by its display parameters (Dougherty, G., 2011, p.29). This loss in data transmission results in noise and artefacts in images, however masks and filters can be applied to these images to remove or minimise noise. Some examples include median and averaging masks used in the spatial domain and band-pass and notch filters used in the frequency domain.

Noise Removal Background Image enhancement in the spatial domain involves directly manipulating the pixel intensity rather than modifying the Fourier transform as with the frequency domain. Noise can be defined as the unwanted fluctuations in pixel values around the expected pixel value (Dougherty, G., 2011, p.247). Salt and Pepper noise occurs when random pixels in an image are either turned on or off and are set to white and black respectively. That is, some pixels values are set to 255 while others are set to zero, despite unaffected pixels retaining their normal values. This is a direct result of data transmission errors (Dougherty, G., 2011, p.251). Gaussian noise refers to the way that pixel grey values are distributed around the mean in a bell curve (a Gaussian curve) as shown in figure 1. A Gaussian mask would ideally be the best to correct noise but because the averaging mask works similar to the Gaussian mask, however with a different number pattern inside the mask, it also gives a reasonable result (Fisher, R., et al. 2003). Gaussian noise is created during signal acquisition, such as sensor noise or from signal transmission (Dougherty, G., 2011, p. 251). Figure 1: Gaussian Noise Distribution (Mercer, C. (2001))

A histogram can be used in conjunction with an image to show the number of pixels present and at what particular grey level values these pixels are. It is a graphical representation of the frequency distribution of pixels. A histogram can also show maximum and minimum pixel values, and the difference between them (contrast), mean pixel value, and the spread

of pixels (dynamic range). However, they cannot show spatial data, that is, the location of the pixels in the image (Dougherty, G., 2011, p. 124). To improve this noise, a mask can be applied to the image. A mask is a mathematical algorithm that is used to smooth out the peaks and troughs in a histogram by removing or altering pixel values in that image. When this smoothing does not result, a different mask may need to be applied (Bushberg, 2002, p. 312). Both median and averaging masks are smoothing masks and operate in the spatial domain, which is the normal 2 dimensional image space (Fisher, R. 2003).

The Median mask smooths the noise whilst maintaining sharp edges in an image. They remove the noise by replacing pixels which differ, to an extent, from those in a given neighbourhood, with a median or middle value of that neighbourhood This eliminates outlying pixel values such as 0 and 255 created by salt and pepper noise. As the mask moves into an edge, it will contain some low and some high pixel values. If the mask contains more high values, the median will be high and vice versa, hence maintaining image contrast (Dougherty, G., 2011, p. 176). This mask is rotated through 180° and moved in a raster fashion across the input image until every pixel has been adjusted, known as convolving (Bushberg, 2002, p. 312). Median masks produce the best results when acting on salt and pepper noise but are not as good as smoothing other types of noise as the averaging mask (Dougherty, G., 2011, p. 252). An averaging mask results in each pixel in the output image being formed from an average of the pixels in the neighbourhood surrounding that pixel in the input image, known as neighbourhood averaging. This mask also operates in a convolution process (Dougherty, G., 2011, p. 172). . It is a linear filter because it replaces each pixel by a linear combination of its neighbours (Burger, W. & Burge, M. J., 2009, p. 116). An averaging filter smooths the image and reduces noise by reducing abrupt variations in local pixel grey values; however, this also reduces sharp edges because the high frequencies in the image which contain information on sharp edges are attenuated or weakened (Dougherty, G., 2011, p. 176). These masks are also subject to ringing artefacts due to its sharp discontinuities (Dougherty, G., 2011, p. 173).

Practical 1. 2. 3. 4.

Open Image J Go to File/Open and open noisyS&Pskull Go to Analyse/Histogram and display the grey level histogram Select an averaging filter of radius 5x5 by going to Process/Filters/Mean and selecting a radius of 2.0 pixels 5. Repeat and compare with a 5x5 median mask by going to Process/Filters/Median and selecting a radius of 2.0 pixels (note: perform this task on the original image) 6. Go to File/Open and open noisyGskull

7. Repeat steps 3 to 5 with the new noisyGskull image

Results With Salt and Pepper Noise Image 1. Original image and its histogram:

Image 2.After applying a 5x5 averaging mask:

Image 3.After applying a Median mask:

With Gaussian Noise

Image 4. Original Image and its histogram:

Image 5. After applying a 5x5 averaging mask:

Image 6. After applying a Median mask:

Discussion The application of applying averaging and median masks to salt and pepper as well as Gaussian noise has varying affects. In both situations, the averaging mask is seen to blur edges whilst reducing noise, however, the median mask manages to maintain sharp edges whilst reducing noise. This is because the averaging mask averages the values and results in a shallower gradient in pixel values across the neighbourhood, hence widening the sharp edge and blurring the image. The median mask, however, maintain bright and dark areas and the sharp transition between them as it selects the middle pixel value. This is demonstrated in figure 2. It is noted from selecting varying matrix/mask sizes that an increase in matrix size will result in more blurring for both the averaging and the median masks. This is because there is a bigger range of pixel range values in a larger neighbourhood which makes the altered value less accurate.

Figure 2: Original Edge Pixel Values (Dougherty, 2011, P.176)

After Applying an Averaging Mask

After Applying a Median Mask

To the human eye, the median mask acts perfectly on salt and pepper noise. This happens because black and white pixels of the salt and pepper noise are totally eliminated when the middle value in the neighbourhood is selected. This does not work so well for Gaussian noise because of the way the noise is distributed around the bell curve without significant outliers. As seen in the results, an averaging mask works better to reduce Gaussian noise because it acts similar to the ideal Gaussian mask. The Histogram of the original salt and pepper noise image appears rather flat and ranges from 0 right through to 255. This is because the salt appears white at 255 and the pepper appears black at 0. After the averaging mask was applied, the image histogram shows more defined peaks. This is because pixels that once contributed to the 0 and 255 salt and pepper noise have had their grey scale value changed and now add to the number of pixels that increase the peaks. The histogram is also shortened where the values 0 and 255 were

altered and they now appear as 7 and 205 as hence when looking at the image, the harsh black and white S+P noise has been reduced. The histogram after the median mask was applied is even shorter again (represented by 8 and 201 for minimum and maximum values respectively) as a result of an even greater improvement in reducing the noise. The histogram of the original Gaussian noise image has two distinct peaks with a fairly smooth valley. This histogram is also shorter after applying the averaging mask. This is because averaging the values with other values in the neighbourhood eliminates outliers. The histogram still follows the same general shape of the original Gaussian noise image histogram; however, more smaller peaks identified. This results from the Gaussian noise pixels being altered and adding to the number of pixels at another grey value. After applying a median mask, the histogram remains similar to the shape of the histogram after applying an averaging mask; however, the peaks and troughs aren’t as prominent. Neither the averaging or the median mask enhance the image greatly and this is because the noise is fit to a specific Gaussian curve, therefore a Gaussian mask would ideally remove the noise and enhance the image.

Band Pass and Notch Filters Background The Fourier transform converts the spatial domain representation of an image into a frequency domain representation (Dougherty, G., 2011, p. 194). The process assumes images can be represented by a sinusoidal wave, thus it converts the image into an amplitude spectrum, showing the number of different frequencies, and a phase spectrum, showing their position (Dougherty, G., 2011, p. 198). This could also be visualised by the way a prism splits white light into colours depending on their frequencies, however, the fourier transform splits the image into its components depending on their frequencies (Punskaya, E., 2009). Band pass filters are a combination of both high pass and low pass filters as shown in figure 3 (Dougherty, G., 2011, p. 227). Low pass filtering is used to produce a smoother image and reduce

noise. It passes all frequencies up to a certain cut off and removes all frequencies beyond that. It preserves low frequencies and removes higher ones which contain the information about sharp edges (Dougherty, G., 2011, p. 223). High pass filtering passes all frequencies higher than a certain cut off frequency and removes all frequencies below this cut off frequency. It is often used to extract edges in an image as it only allows the higher value pixels to through. As edges are made from the transition of low to high pixel values, by allowing the higher values through the edge is enhanced (Dougherty, G., 2011, p. 225). Therefore a band pass filter blocks all frequencies smaller than a certain low frequency and higher than a certain high frequency and passes all frequencies in the middle.

Figure 3: Ideal Pass Band Filters (Storr, W. 2014)

This kind of band pass filter is an ideal band pass filter, otherwise known as a brick wall filter, as they have a sharp cut off at a particular frequency. However, due to the sharp discontinuities, ringing artefacts result in the spatial image as shown in figure 4. To prevent these artefacts, the practical filter uses a more gradual transition, so the filter appears with a Gaussian (bell curve) profile such as a Butterworth filter, which passes all frequencies above a certain frequency and block all frequencies below a lower frequency and attenuates all frequencies in between and vice versa as demonstrated in figure 5 (Dougherty, G., 2011, p. 226).

Figure 4: Ideal Pass Band Showing Ringing Artefact (Zheng, X. 2014)

Figure 5: Practical Pass Band (Paynters, R. 2001)

A band reject filter occurs when a filter has an inverse frequency response to the band pass filter, i.e. the graph appears upside down. If the reject band is narrow, a notch filter results (Dougherty, G., 2011, p. 228). A notch filter is useful for removing certain frequencies such as interference patterns. This is carried out by painting over, or notching, the particular frequency in the frequency domain image, and when the image is converted back to a spatial representation, these frequencies/patterns are supressed (Honey, I. D., et al. (2005). This is because the filter multiplies that particular frequency by zero, eliminating it; however, spatial details are also eliminated at that frequency so image degradation may result (Dougherty, G., 2011, p. 228).

Practical PART 1 1. File/Open axialbrainMRI 2. Band pass axialbrainMRI by going to Process/FFT/Bandpass Filter and start with the default values 3. Select the Display Filter option to see the filter used in each case 4. Repeat steps 2 and 3 with the following pixel values Filter high pixels values to: 40 10 9999

Filter low pixel values to: 3 1 20

PART 2 1. File/Open Striped Lena 2. Take the fast fourier transform by going to Process/FFT/FFT 3. Using the paintbrush tool in the Tools menu, paint black, the diagonal spots in the fourier/frequency domain image that correspond to the diagonal stripes in the original image 4. Take the inverse transform by selecting Process/FFT/Inverse FFT 5. Take the Fourier transform of this improved image 6. Now paint out the streaks that pass through the spots in the frequency domain image that corresponds to the diagonal stripes in the spatial image 7. Once again take the Fourier transform

Results Axial Brain MRI Image 1. Original Image Axial Brain MRI

Image 2. Axial Brain MRI and its Filter after Applying a Band-Pass Filter of Default Values

Image 3. Axial Brain MRI and its Filter After Filtering Large Structures Down to 10 and Small Structures up to 1

Image 4. Axial Brain MRI and its Filter After Filtering Large Structures Down to 9999 and

Small Structures up to 20

Striped Lena

Image 5.Original Image and its Magnitude Image

Image 6.Painting the Diagonal Spots of the Magnitude Image

Image 7.Resultant Image and its Magnitude Image After Painting the Diagonal Spots in the original Magnitude Image

Image 8. Painting the streaks that pass through the spots in the magnitude image

Image 9. Resultant Image and its Magnitude Image After Painting out the Streaks

Discussion Applying a band pass filter to axialbrainMRI affects which frequencies appear in the output image. Allowing more high value frequencies through will result in enhanced edges in the spatial image and this result can be seen in image 9. As seen in image 10, allowing more low value frequencies through results in image blurring because the high value frequencies which contain information on the sharp edges are removed. (Klifa, C., 2009). Smoother images may make it easier to recognise features in the image by blurring small gaps and greyscale variations within them (Dougherty, G., 2011, p. 224). The above images, 8, 9 and 10, which have had a filter applied to them, show no ringing artefact like an ideal pass band would suggest. This is because they use a smoother Gaussian profile filter. The stripe artefact was successfully removed from the striped Lena image once a notch filter was applied to the frequency image. This is because the frequency that matched up to the stripe was painted over and supressed. After painting spots over the diagonal stripe frequency, most of the stripes were removed, however, some remained at the peripheries. This is because painting the spots doesn’t remove all of the frequencies that contribute to the stripe artefact. Therefore, painting the entire line that passes through the spots will remove all of the frequencies that contribute to the stripes in the spatial image, hence removing all of the stripes. The final image however, appears to be of lesser quality than it could be. This is because some of the spatial details that also occur at these frequencies are also supressed (Dougherty, G., 2011, p. 228).

Conclusion Images enhancement and noise reduction can be carried out by applying a variety of masks and filters. These include averaging and median masks as well as band pass and notch filters. Averaging masks worked better on the Gaussian noise whereas median masks worked best to remove the salt and pepper noise in the noisy skull images 1 and 4. Ideal band pass “brick wall” filters produce a ringing artefact so alternate filters need to be used and notch filtering, whilst removing artefacts, can also reduce image quality. It can be concluded that these masks and filters are very useful for certain application, however they all have limitations. (2158) excluding titles, headings and diagrams.

Acknowledgements Xiaoming Zheng - Lectures, lecture notes and tutorials Anta Supomo - Proof reading Andrew Painting – Understanding of band pass filters

Bibliography Burger, W. & Burge M. J. (2009), Principles of digital image processing: Fundamental techniques. Springer-Verlag, London. Dougherty, G. (2011). Digital Image Processing for Medical Applications. Cambridge University Press Honey, I. D.,Evans, D. S., Makenzie, A. (2005). "Investigation of optimum energies for chest imaging using film–screen and computed radiography." The British Journal of Radiology 78(929): 422-427). Fisher, R., Perkins, S., Walker, A., Wolfart, E. (2003) Gaussian Smoothing. Retrieved from: http://homepages.inf.ed.ac.uk/rbf/HIPR2/gsmooth.htm Mercer, C. (2001). Does The Signal Have A Gaussian Probability Density? Received from: http://blog.prosig.com/2001/06/06/does-the-signal-have-a-gaussian-probability-density/ Bushberg, J. (2002). The Essential Physics of Medical Imaging. Lippincott Williams & Wilkins Punskaya, E. (2009). Digital Signal Processing. Retrieved from: https://...


Similar Free PDFs