Home > Computer science essays > Matlab in image processing

Essay: Matlab in image processing

Essay details and download:

  • Subject area(s): Computer science essays
  • Reading time: 8 minutes
  • Price: Free download
  • Published: 4 November 2022*
  • Last Modified: 29 September 2024
  • File format: Text
  • Words: 2,251 (approx)
  • Number of pages: 10 (approx)

Text preview of this essay:

This page of the essay has 2,251 words.

1. INTRODUCTION

Digital image processing is a technology using a computer to process images through a certain algorithm. The system chosen in order to perform the required task plays a vital role in its application. This paper will elaborate on the use of MATLAB software in image enhancement to remove noise from a degraded image without using specialized built in functions of the software. The focus is placed on two types of images: grayscale image and RGB image and how the algorithm can be modified and processed in order to improve visualization and image quality. Finally the results from two different filters: median and mean, are analyzed and compared.

Keywords

Mean; Median; Noise; digital image; processing; RGB Channel; grayscale; matrices ; MATLAB

2. LITERATURE REVIEW

2.1 Computer coding in engineering problems

The purpose of coding is to find a series of instructions that will automate the execution of a task for a given task. Computer programming is essential in solving typical engineering problems since many calculations and analyses can be done faster and more efficiently. The first computers were built to perform specific tasks and therefore the idea to communicate with computers by means of a special language was raised. Programming language was invented to solve this problem. It is a means of translating words accessible to humans to words accessible by computers. There are two kinds of programming languages – low level programming languages and high level programming languages. The first class of language deals with the computer’s hardware and constraints. It can be considered as a computer’s native language. Any code written in low level languages can directly be executed in a computer hardware without any translation. Two main low-level languages are machine code and assembly language. The second group is characterized as more user-friendly. Unlike for low-level languages, high level languages must be interpreted into machine code before being executed. It does not require addressing hardware constraints in the development of programs. The most popular high-level languages include Visual Basic, Python, FORTRAN, Pascal, Java and C++. MATLAB is also an example of a high-level language which is a part of a wider interactive environment.

2.2 MATLAB

2.2.1 History

MATLAB was first introduced as a matrix calculator for the development of two Libraries of FORTRAN in the late 1970s under an endowment from the National Science foundation. These two libraries were called EISPACK and LINPACK. MATLAB, short for “MATrix LABoratory,” was developed by Cleve Moler. At the time Moler was chairman of the Computer Science department at the University of New Mexico and taught mathematics and computer science. The software was a project to provide his student with easy access to LINPACK and EISPACK without having to program FORTRAN. MATLAB soon spread to other universities and found a wide audience particularly among the mathematical community. Students who studied subjects like signal processing and control theory found it is very useful since matrices were central to the mathematics in these subjects. In 1983, Jack Little, an engineering graduate from the University of Stanford proposed the creation of a commercial product based on MATLAB. Even though it was not powerful enough at the time, with the help of Steve Bangert, Little wrote a new and extended version of MATLAB in C. Together, they worked on the new version of MATLAB which included improvements and modifications such as the use of graphics, functions and toolboxes.

2.2.2 Modern MATLAB

2.3 Digital Images

Digital images are a representation of a set of numbers that can be stored and handled by a digital computer. They are displayed as a matrix of pixels (picture elements). The numbers are arranged in an array of rows and columns and each number stores some property of this pixel such as the intensity of light or its colour. If all the pixels in the image have the same pixel values, the image will be of uniform colour, like all black or all red or some other shade of colour. The width of the image is the number of columns and the height of the image is the number of rows. The image size describes the number of pixels within the image. One of the basic characteristics of a digital image is the type of image. There are mainly two types of digital images, black and white and colour also known as grayscale and RGB images. A black and white or grayscale is an image where each pixel is either black or white and nothing else. Colour images on the other hand have intensities from the darkest to lightest of three different colours, Red, Green and Blue. Various intensities of these three colours results in the colour image. Intensities values are defined in bits. A bit is binary has a value of either 0 or 1. The standard digital images uses 8-bit range of intensities. An 8-bit intensity range has 256 possible value, 0 to 255 with 0 being no intensity and 255 being the maximum intensity. The total number of colour possibilities is therefore 2563 = 16,777,216. Digital images are stored a sthree layers each consisting of a matrix to store red , green and blue pixel values. This makes a three-dimensionalimage overall, two dimensions which are as the same size as the image and a third to colour information. Black and White images do not require colour information so they can be stored as two-dimensional matrix of grayscale intensity values. Figure 1 shows an image that has been decomposed into red, green and blue components.

(a) (b) (c) (d)

Figure 1. (a) Image of London eye and its decomposition into red (b) green(c) and blue (d) monochrome images.

2.4 Noise and noise removal in images

SAMPLE: Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee.

Conference’10, Month 1–2, 2010, City, State, Country.

Copyright 2010 ACM 1-58113-000-0/00/0010 …$15.00.

DOI: http://dx.doi.org/10.1145/12345.67890

Noise in an image is what is seen as the oddly colored dots in the picture. It is simply unwanted signals present in the image which are caused by random variations of brightness or color information. Digital images are subjected to noise during transmission or acquisition. The many types of image noise include Gaussian noise, Impulse noise, salt and pepper noise and uniform noise. Noisy images are very common in day to day imaging applications. During transmission, noise may be caused by various sources including atmospheric interference, electrical noise, lightning, car ignition systems, and industrial equipment in the neighborhood. Sometimes noise can be useful but Degradation reduces the performances of many images therefore image processing techniques are an essential in order to restore any original information that has been lost.

3. An Introduction to the problem

Images suffer degradation due to electrical noise during transmission. This causes some of its original information to be lost. There are several methods that can be used in order to restore the lost information. The aim is to develop an algorithm that implements a spatial filter using Matlab in order to remove the noise and improve image quality.

The two proposed noisy images:

 latte_noisy.bmp (black and white images)
 phonebox_noisy.bmp (color image)

4. Methodology

Preprocessing is a step to eliminate unnecessary data in a dataset. The removal of unwanted data before processing gives effective results. Images are preprocessed in order to only the essential piece of information which needs to be further processed. Images are commonly preprocessed to remove noise. Different techniques can be used to perform preprocessing in images. One of the ways to perform a smoothing process in an image is to consider each pixel values and its neighborhood.

4.1 Mean filtering

Mean filter is the simplest linear filter used to filter an image. It smoothers the image by replacing each pixel value by the average value of itself and its neighborhood pixel intensities as shown in figure 1. It is easy to implement but is not powerful enough when the pixel values have large noise deviations.

4.2 Median Filtering

Median filtering is a simple image processing technology which uses order-statistics theory. In Median filtering the value of a preferred pixel is replaced by the median of itself and its neighborhood pixels and thus noise points will be annihilated. For calculating the median all the pixel values from its neighbourhood are first sorted in numerical order, then the target pixel value is replaced with the middle pixel value as illustrated in figure 1.

Neighborhood values: 121, 115, 110, 129, 179, 119, 117, 112, 130

After sorting in ascending order:

110, 112, 115, 117, 119, 121, 129, 130, 179

MEDIAN VALUE = 119

As illustrated in the figure the middle pixel value of the 3×3 matrix is replaced by the median value. The odd value which caused a noise point is now a close representative of its neighbourhood.

4.3 Building and Testing

4.3.1 Functions used

imshow – Used to display the image data.
imread – This function reads and image from the file specified by its filename
imtool – Displays the image contained in the graphics file filename.

4.3.2 Testing the Algorithm

The proposed algorithm is tested on a simple set of data, before processing the image. A simple 5×5 matrix is chosen as shown in figure. The full set of matlab codes used is given in the appendix

Figure . A simple 5×5 matix

imshow(A) gives image data of matrix A

Figure . image data of matrix A

A variable B is now assigned to our matrix to be processed. The use of two variables is to retain the original matrix for comparison with the output matrix after running the code.

B = A

If rows are denoted by ‘m’ and columns are denoted by ‘n’,

Then m = 2:4, n = 2:4

B(m,n) = median([A(m-1,n-1), A(m-1,n), A(m-1,n+1), A(m,n-1), A(m,n), A(m,n+1), A(m+1,n-1), A(m+1,n), A(m+1,n+1)]) ;
Here, the target pixel value is at the position (m,n) and so the rest of the neighborhood values will be read accordingly. For example the pixel value right about the target pixel is in the previous row but the same column, hence its position will be (m-1, n). But the first target value is the number positioned at the second row and second column. Why don’t we take into account the first pixel value?

This is because any pixel at the edges do not have neighborhood, and therefore when the code is run it will read an error because it exceeds array boundaries.

After running the code, each pixel value will be manipulated and replaced by the median value of itself and its neighborhood pixel intensities. Subsequently, if the processed matrix is now viewed it will appear as shown in figure
imshow(B)

Figure. Image data of matrix B

It can be seen that the jaggedness has been removed and a much smoother output of the image is produced.

4.4 Results from a wider neighbourhood

5. SECTIONS

The heading of a section should be in Times New Roman 12-point bold in all-capitals flush left with an additional 6-points of white space above the section head. Sections and subsequent sub- sections should be numbered and flush left. For a section head and a subsection head together (such as Section 3 and subsection 3.1), use no additional space above the subsection head.

5.1 Subsections

The heading of subsections should be in Times New Roman 12-point bold with only the initial letters capitalized. (Note: For subsections and subsubsections, a word like the or a is not capitalized unless it is the first word of the header.)

5.1.1 Subsubsections

The heading for subsubsections should be in Times New Roman 11-point italic with initial letters capitalized and 6-points of white space above the subsubsection head.

5.1.1.1 Subsubsections

The heading for subsubsections should be in Times New Roman 11-point italic with initial letters capitalized.

5.1.1.2 Subsubsections

The heading for subsubsections should be in Times New Roman 11-point italic with initial letters capitalized.

6. ACKNOWLEDGMENTS

Our thanks to ACM SIGCHI for allowing us to modify templates they had developed.

7. REFERENCES

[1] Bowman, M., Debray, S. K., and Peterson, L. L. 1993. Reasoning about naming systems. ACM Trans. Program. Lang. Syst. 15, 5 (Nov. 1993), 795-825. DOI= http://doi.acm.org/10.1145/161468.16147.

[2] Ding, W. and Marchionini, G. 1997. A Study on Video Browsing Strategies. Technical Report. University of Maryland at College Park.

[3] Fröhlich, B. and Plate, J. 2000. The cubic mouse: a new device for three-dimensional input. In Proceedings of the SIGCHI Conference on Human Factors in Computing Systems (The Hague, The Netherlands, April 01 – 06, 2000). CHI ’00. ACM, New York, NY, 526-531. DOI= http://doi.acm.org/10.1145/332040.332491.

[4] Tavel, P. 2007. Modeling and Simulation Design. AK Peters Ltd., Natick, MA.

[5] Sannella, M. J. 1994. Constraint Satisfaction and Debugging for Interactive User Interfaces. Doctoral Thesis. UMI Order Number: UMI Order No. GAX95-09398., University of Washington.

[6] Forman, G. 2003. An extensive empirical study of feature selection metrics for text classification. J. Mach. Learn. Res. 3 (Mar. 2003), 1289-1305.

[7] Brown, L. D., Hua, H., and Gao, C. 2003. A widget framework for augmented interaction in SCAPE. In Proceedings of the 16th Annual ACM Symposium on User Interface Software and Technology (Vancouver, Canada, November 02 – 05, 2003). UIST ’03. ACM, New York, NY, 1-10. DOI= http://doi.acm.org/10.1145/964696.964697.

[8] Yu, Y. T. and Lau, M. F. 2006. A comparison of MC/DC, MUMCUT and several other coverage criteria for logical decisions. J. Syst. Softw. 79, 5 (May. 2006), 577-590. DOI= http://dx.doi.org/10.1016/j.jss.2005.05.030.

[9] Spector, A. Z. 1989. Achieving application requirements. In Distributed Systems, S. Mullender, Ed. ACM Press Frontier Series. ACM, New York, NY, 19-33. DOI= http://doi.acm.org/10.1145/90417.90738.

2019-2-13-1550096660

About this essay:

If you use part of this page in your own work, you need to provide a citation, as follows:

Essay Sauce, Matlab in image processing. Available from:<https://www.essaysauce.com/computer-science-essays/matlab-in-image-processing/> [Accessed 19-11-24].

These Computer science essays have been submitted to us by students in order to help you with your studies.

* This essay may have been previously published on EssaySauce.com and/or Essay.uk.com at an earlier date than indicated.