Transcript Slide 1

IMAGE
PROCESSING
USING MATLAB
IMAGE
An image may be defined as a two
dimensional function f(x,y), where x and y
are spatial coordinates.
The amplitude of f at any pair of
coordinates (x,y) is called the intensity or
gray level of the image at that point
When x, y, and the amplitude values of f
are all finite, discrete quantities, we call the
image a digital image
Image Processing
The field of digital image processing refers
to processing digital images by means of a
digital computer
PIXELS
A digital image is composed of a finite
number of elements, each of which has a
particular location and value. These
elements are referred to as picture
elements, image elements, pels, and pixels
►Pixel is the term most widely used to
denote the elements of a digital image.
USING MATLAB
Here we discuss some basic image
processing concepts

Read and display an image

To check how the image appears in the
workspace

Improving the contrast of the image

Writing the contents to a disk file

Checking the newly written file.
READ AN IMAGE
To read an image, use the imread
command. The syntax is as follows
I = imread('pout.tif');
tif indicates that file format is Tagged
Image File Format (TIFF)
TIFF is used for desktop publishing
DISPLAY AN IMAGE
To display an image we use two functions
imshow and imtool
imshow is the toolbox’s fundamental image
display function
IMAGE IN WORKSPACE
The
Workspace
browser
displays
information about all the variables you
create during a MATLAB session.
You can also get information about
variables in the workspace by calling the
whos command.
IMPROVING CONTRAST
To improve the contrast of the image we
should know the histogram of the image.
To see the histogram use the command
imhist
one way to improve contrast is go for
histogram equalization and for that we use
the command histeq
WRITE THE IMAGE TO A DISK
FILE
To write the newly adjusted image to a disk
file, use the imwrite function.
imwrite (I2, 'pout2.png');
CHECKING THE NEWLY
WRITTEN FILE.
To see what imwrite wrote to the disk file,
use the imfinfo function
imfinfo('pout2.png')
IMAGES IN MATLAB
The basic data structure in MATLAB is the
array, an ordered set of real or complex
elements.
MATLAB stores most images as twodimensional arrays (i.e., matrices), in
which each element of the matrix
corresponds to a single pixel in the
displayed image.
IMAGE COORDINATE SYSTEMS
Here we discuss the following topics
 Pixel Coordinates
 Spatial Coordinates
PIXEL COORDINATES
In this coordinate
system, the image is
treated as a grid of
discrete
elements,
ordered from top to
bottom and left to
right
You use normal MATLAB matrix subscripting
to access values of individual pixels.
For example I(2,15) returns the value of the
pixel at row 2, column 15 of the image I.
SPATIAL COORDINATES
In this spatial coordinate system, locations
in an image are positions on a plane, and
they are described in terms of x and y (not r
and c as in the pixel coordinate system).
SPATIAL COORDINATE SYSTEM
IMAGE AVERAGING
To calculate the average of two images we
can use image arithmetic functions
I = imread('rice.png');
I2 = imread('cameraman.tif');
K = imdivide(imadd(I,I2), 2);
or
K = imlincomb(.5,I,.5,I2);
LINEAR FILTERING
Linear filtering of an image is
accomplished through an operation called
convolution.
Convolution is a neighborhood operation in
which each output pixel is the weighted
sum of neighboring input pixels
CONVOLUTION EXAMPLE
I = imread('coins.png');
h = ones(5,5) / 25;
I2 = imfilter(I,h);
imshow(I), title('Original Image');
figure, imshow(I2), title('Filtered Image')