Image Processing Using Matlab Computer Science Essay
Image Processing Toolbox allows a comprehensive set of mentioned algorithms, functions, and apps for image processing, analysis, visualization, and algorithm development. We can perform image development, image film over, noise diminution, geometric transformations, and image registration. Most of toolbox functions are multithreaded to accept benefits of multicore and multiprocessor computers.
Image Processing Toolbox confirms a various set of image types, giga pixel resolution and tomography. When we search an image, analyze a region of pixels, set the contrast, draw contours or histograms, and influence regions of interest. With toolbox algorithms we can fix low images, find and evaluate features, examine shapes and textures, and fix color balance.( http://www.mathworks.com/products/image/)
Matlab Working Environment
On Matlab desktop there is a command window where we type commands and expression. Workspace shows the variables which are created when we use commands or expression. Current directory shows the work path. Command history contains the record of commands which we use on command window. (Gonzalez book)
Struggling with your essay?
Fig1. Matlab Desktop layout
When functioning in Matlab then there will be lots of things to be remembered such that loading an image, use the right format, save the data as different data types, image displaying, changing between distinct image formats. Here we give some of the commands made for these operations. In Matlab we require to install image processing tool box for most of commands..
At Matlab prompt write 'ver. This gives a list of tool boxes that are installed on the system.
Use Matlab's help browser for further references. There is a wide range of online practice to access through Matlab's help browser for the Image processing tool box. http://amath.colorado.edu/courses/5720/2000Spr/Labs/Worksheets/Matlab_tutorial/matlabimpr.html)
Image formats designed for Matlab are
Format Name Description Recognized Extension
BMP Windows Bitmap .bmp
TIFF Tagged Image File Format .tif,.tiff
JPEG Joint Photographic Experts Group .jpg,.jpeg
GIF Graphics Interchange Format .gif
PNG Portable Network Graphics .png
Mostly images we see on internet are of JPEG format. This format is widely used for images as standard. When we stored an image then at the end we see in which format it is stored in. For example, rose.jpg is stored in JPEG format. After that we can load this image into Matlab.
Working formats in Matlab
When image is stored as JPEG format, load it into Matlab.Now when we perform a transform on the image, we must convert the image into different format. There we discuss four formats
Intensity image (gray scale image)
Gray scale image format represent a matrix. Each element of matrix corresponds how dark/bright the pixel should colored at the representing position. To represent the brightness of the pixel there are two ways.
Double class assigns a floating number between 0 and 1.0 is for black and 1 is for white.
Unit8 class allots an integer between 0 and 255 to make up the pixel brightness.0 is for black and 255 is for white.Unit8 class requires 1/8 of the storage as compared to class double.
Binary image format stores an image like a matrix but pixel color are only black and white. It allots 1 for white and 0 for black.
To represent color image index image is best way. In this image type two matrices are stored. First matrix's size is similar to image size and also with one number for a pixel. Second one is called as color map and the size of this matrix is different from image size. The numbers use in first matrix is direction of what number is use in the second one.
In this format color images constitute of three matrices. The size of matrix matching with image format. Each matrix represent in red, green or blue color. Each matrix gives instruction about certain pixel use.
When we want to study a sequence of image for biological and medical imaging. When we study a repeated of piece of a cell, multiframe format is better way.
When we store a graphic file then it is not stored as Matlab matrix. Mostly graphic files have some specific information attached with this file. Mostly graphics can read as continuous stream. So we cannot use matlab (input output) commands 'load' and 'save' to read or write image. So we use this syntax to read an image.
For example to read the image rose. tiff we use this syntax
>>imread ('rose. tiff ');
'imread' function can read image file with any file format supported. The images which are of 8 bit will be stored as uint 8 class. For colored images it is stored in class double. It will be class double even image is of uint 8 or uint 16.In uint 16 file format will be PNG or TIFF.
When we want to save graphic file then we use the syntax 'inwrite'. Mostly files are saved in uint 8 class because mostly graphics used in Matlab are of bit 8. So these files do not require class double format. PNG and TIFF support bit 16 so we can overcome on this problem by specifying uint 16 as data type format for 'imwrite'.
This essay is an example of a student's work
So for saving an image syntax will be
imwrite (s, 'filename')
For example we want to save a file in jpg format then syntax will be
Where s is a variable we used to store file in the directory.
If we want to save the file in best quality then syntax will be
>>imwrite(s, 'rose.jpg', 'quality', q)
Where q is use for quality its value will be form 0 to 100.
Here at the end of syntax we do not use semicolon because it has no effect so we normally we are not using it here.
Now if we want to display image then we use the command
here also semicolon is not needed.
Fig2. Image of a rose.
Figure shows the result.
There is a table which shows the use of some of Matlab commands.
To read an image imread
To write an image imwrite
To display an image imshow/imagesc
To find the size which gives rows and column dimensions of an image size(filename)
To know additional information such as class, size and bytes of an image whos filename
To know the image file details imfinfo filename
(http://www.mathworks.com/help/matlab/creating_plots/reading-writing-and-querying-graphics-image-files.html) & (Gonzalez book)
MATLAB programming is most easy and compromising way to learn. Generally we use command window to operate commands one at one time. But M-files give us a way of performing a series of command at a time. M-files is a method of solving problems in different way. We can create M-files by using editor. M-files are stored in the form filename.m such that thesis.m.
M-files contain following different portions
ï¿½ Function definition
ï¿½ HI line
ï¿½ Function body
First line of m-file is of function definition such that
Function = name
function=imadd (A, B)
Next line of m-file is HI line which is the first text line. There is no blank line between HI line and function definition In function body there is code of function. We use % for remarks after every line to explain what is doing here. (Gonzalez book)
Below there is an example of m-file
%% read the image from the file system
I = imread ('cameraman.tif');
%% create a new figure to show the image.
%% show the loaded image.
J = imnoise (I, 'Salt & pepper', 0.05);
%% create a new figure to show the image.
%% show the loaded image.
%% apply median filter using the internal matlab function medfilt2.
Y=medfilt2 (J, [5 5]);
%create a figure to show the filtered image
%% show image after applying the filter
And the result will be
(a) (b) (c)
Figure (a): original image
Figure (b): noisy image
Figure(c): filtered image
Filters may be classified in these ways:
1. digital or analog
2. sampled or non sampled
3. linear or non-linear
4. passive or active type of continuous-time filter
5. Infinite impulse response (IIR) or finite impulse response (FIR) type of discrete-time or digital filter.
If you are the original writer of this essay and no longer wish to have the essay published on the UK Essays website then please click on the link below to request removal: