You are on page 1of 14

Swinburne University of

Technology
Faculty of Engineering and Industrial
Sciences

EEE40003
DIGITAL SIGNAL
&
IMAGE
PROCESSING
Lab 4: Image Processing
Group: 07 (Tuesday 12.30 pm)
Student Name

Student Number

WARNAKULASURIYA
PEIRIS

1729608

Signature

EEE40003 DSP |Lab Report Image Processing

PART A
A1: Reading an Image
1)
For reading the image trio.tiff into an image array called trio we used the
command trio=imread (trio.tiff). This image is stored in a matrix of 256 x 256
as a 8-bit unsigned integers.

A2: Displaying an Image

Command:
trio = imread('trio.tiff');
imshow(trio)

Size: 256 x 256 units 8

2)
The image above is an intensity image where the array values are given as
intensity values. For 8 bit integer arrays 0 corresponds to black and 255 to white.

A3: Pseudocolor
3)

EEE40003 DSP |Lab Report Image Processing

Command:
colormap('hsv');

The picture above is an indexed image where the array values are given as
indexes into a colour look-up table. For 8-bit data, 0 corresponds to the first
element, 1 is for the next entry and like that till up to 255.

4) With colour bar

250
200
150
100
50
0

5)

EEE40003 DSP |Lab Report Image Processing

Command: colormap('hot');
colormap('cool');

Command:

The colour scale used for the


above picture (hot) is between
the 0-50 in the colour scale.

The colour scale used for the


above picture (cool) is in
between 100 to 200 in the
colour scale.

A4: Grey Scale Distribution


6)
250

Command:

200

imshow(trio);

150

improfile;
100

50

50

100
150
Distance along profile

200

250

The method above helps us to examine the variation of intensity across an


image. By this we can estimate the subtle changes in intensity that is below the
perceptual threshold.

Command:
iprocprofile(trio); EEE40003 DSP |Lab Report Image Processing

From the image above


image, we observe that the
red line starts from the
white region, where the
graphs indicate that there is
an intensity of around 200
at that region. When it
comes to black part, we can
see that the intensity graph
falls to almost 0.

250

Intensity

200

150

100

50

7)
100 200
Distance

300

250

250

200

200

150

150

Intensity

Intensity

100

50

50

100

50
100
Distance

150

20 40 60
Distance

Intensity

Command:
250

coin = imread('coin.tiff');

200

coin1=imread('coin1.tiff');

150

iprocprofile(coin);

100

50

50 100 150
Distance

8)
EEE40003 DSP |Lab Report Image Processing

Intensity

200

100

50

100
Distance

150

200

Intensity

200

100

20

40

60

80 100
Distance

120

140

160

180

Command:
iprocprofile(coin,coin1)

QUESTION 1:
From part 8, we can clearly observe the difference between the figures
of coin and coin1. The figure of coin shows that it has less illumination
than coin1 figure. Also, the distance v/s intensity graph clearly shows
the intensity of both images, where blue line represents coin and red
line coin1 figures.

PART B: GREY SCALE INTENSITY MAPPING


B1: Intensity Mapping
1)

EEE40003 DSP |Lab Report Image Processing

Command:
dimroom=imread('dimroom.tiff
');
imshow(dimroom);

Gamma= 1
Command:
adjroom=imadjust(dimroom,[0
0.3],[0 1],1);
figure(2);
imshow(adjroom);

Gamma=3
Gamma= 6

EEE40003 DSP |Lab Report Image Processing

Command:

Command:
adjroom=imadjust(dimroom
,[0 0.3],[0 1],3);
figure(2);

adjroom=imadjust(dimroom,
[0 0.3],[0 1],6);
figure(2);
imshow(adjroom);

imshow(adjroom);
Considering the above images, where we used different gamma values (1, 3, 6),
we can clearly say that if gamma value increases the image gets darker and
darker. Thereby, arriving at a conclusion that intensity will be higher for the less
gamma values images.

2)
Command:
adjroom=imadjust(dimroom,st
retchlim(dimroom),[0 1],1);
figure(2);
imshow(adjroom);

The method used in the image above is called Stretchlim. This is a another way
to improve the image, by evaluating the input values.

B2: Image Histograms


3)
EEE40003 DSP |Lab Report Image Processing

x 10

Command:

[h1,x1]=imhist(dimroom);

[h2,x2]=imhist(adjroom);

0
0

50

100

150

200

250

300

subplot(2,1,1);

x 10

stairs(x1,h1);

subplot(2,1,2);

2
0
0

stairs(x2,h2);
50

100

150

200

250

300

The above histogram plots indicate the variation of different intensity of the
number of pixels of image dimroom and adjroom (where we used stretchlim).

QUESTION 2:
From the figure above we can observe the difference between the
two histogram plots. The first figure is kind of stacked together,
but the second figure is well spaced and occupied. Finally, we can
arrive at the conclusion that the second figure has high intensity
and thereby giving a brighter image.
Command:
[hroom,tout]=histeq(dimroom)
;
figure(1);
subplot(2,2,1);
imshow(dimroom);
subplot(2,2,2);
imshow(hroom);

B3: Histogram Equalisation


4)

subplot(2,2,3);
stairs(x1,h1);

[h3,x3]=imhist(hroom);
EEE40003 DSP |Lab Report Image
Processing 9
subplot(2,2,4);
stairs(x3,h3);

x 10

100

200

300

x 10

100

200

300

5)
1
0.9

Command:

0.8
0.7

tin=linspace(0,1,256);

0.6
0.5

clf

0.4

plot(tin,tout)

0.3
0.2
0.1
0

0.2

0.4

0.6

0.8

QUESTION 3:
We can clearly account the difference in the graph plotted in part
5 above. For small values of input, the output has risen steeply
and after reaching the input value near to 1, we can observe that
there is no considerable rise in the output value.

PART C: Thresholding and Binary Images


C1: Thresholding an Image
EEE40003 DSP |Lab Report Image Processing

10

We can convert a greyscale image to a binary image by thresholding at the level,


which range from values 0 and 1. The image thus obtained is stored in an array
of logical values zeroes and ones.

1)

Command:
grid=imread('grid.tiff');
imshow(grid);
tgrid=im2bw(grid,0.3);
figure;
imshow(tgrid);

The image above is at threshold level 0.3.

2)

50

50

100

100

150

150

200

200

250

250

300

300
50

100

150

200

250

Command:
grid=imread('grid.tiff');
imshow(grid);
50

300

100

150

200

250

300

tgrid=im2bw(grid,0.3);
figure;
imshow(tgrid);
iprocthold(grid);

50

50

100

100

150

150

200

200

250

250
300

300
50

100

150

200

250

300

50

100

150

200

250

300

From the figures above we can say that for small threshold values there will be
whiter region, where it is converted to the binary number 1. If we increase the
EEE40003 DSP |Lab Report Image Processing

11

threshold level, the picture become darker and it is converted to corresponding


binary number 0.

C2: Correcting Illumination Gradients


3)

50

50

100

100

150

150

grid1=imread('grid1.tiff');

200

200

iprocthold(grid1);

250

250

300

50

100

150

200

250

300

Command:

300

50

100

150

200

250

300

In the figure above, we attempt to separate the foreground and background level
of average intensity. It is quite difficult in practise to separate foreground and
background.

4)

Command:
50

50

100

100

150

150

200

200

250

250

300

300

50

100

150

200

250

300

blank=imread('blank1.tiff');
grid2=iprocnorm(grid1,blank);
iprocthold(grid2);
50

100

150

200

250

300

In the figure above, we can see that the foreground and background is separated
almost correctly. This is because we use a blank image with the same
illumination as the original image. Then we use the blank image as the reference
image to correct the original image and then used iprocthold to obtain a single
threshold level.
EEE40003 DSP |Lab Report Image Processing

12

5)

Command:
iprocprofile(grid1,grid2)

I n t e n s it y

250
200
150
100
50
50

100
150
Distance

200

250

250

200

200

Inte ns ity

Intens ity

150
100
50
0

150
100
50

50

100
150
Distance

200

20

40

60

80

100 120
Distance

140

160

180

200

By comparing the images grid1 and grid2, we can observe that the original
image grid1 has less intensity than the corrected image grid1 even though they
have the same shape. The red line represents the corrected image and blue line
represents the original image.

QUESTION 4:
It is difficult to find the single threshold level for the grid1 image
because the intensity level of foreground and background are not
uniform. For the grid2 image the intensity levels are almost
unique and we can find a single threshold level easily and thereby
converting to a binary image.

EEE40003 DSP |Lab Report Image Processing

13

C3: Edge Detection


6)
Sobel Method

Command:
trio1=edge(trio,'sobel');
imshow(trio1);

In the image above we used sobel method to detect the edge of the image.
Canny Method

Command:
trio2=edge(trio,'canny');
imshow(trio2);

In the image above, it more clear detection of the edge and the method we used
here is called canny method.

EEE40003 DSP |Lab Report Image Processing

14

You might also like