Dip Lab Report 3
Dip Lab Report 3
LAB REPORT 03
Submitted To:
Dr. Sajjad Ali Haider
Threshold it at
(a) level 100 (b) level 150
Code:
% Define the 8x8 image
image = [3 148 117 148 145 178 132 174;
2 176 174 110 185 155 118 165;
0 100 124 113 193 136 146 108;
0 155 170 106 158 130 178 170;
9 196 138 113 108 127 144 139;
6 188 143 183 137 162 105 169;
9 122 156 119 188 179 100 151;
8 176 137 114 135 123 134 183];
subplot(1, 2, 2);
imshow(threshold_150);
title('Threshold at Level 150');
Results:
Task No 2: Superimpose the image text.tif onto the image cameraman.tif. You can do
this with:
>> t=imread('text.tif');}
>> c=imread('cameraman.tif');}
>> m=uint8(double(c)+255*double(t));}
Can you threshold this new image m to isolate the text?
Code:
% Read the images
t = imread('trees.tif');
c = imread('cameraman.tif');
Task No 3: The following small image has grey values in the range 0 to 19.
Compute the grey level histogram and the
mapping that will equalize this histogram. Produce an 8x8 grid containing the grey
values for the new
histogram-equalized image.
12 6 5 13 14 14 16 15
11 10 8 5 8 11 14 14
9 8 3 4 7 12 18 19
10 7 4 2 10 12 13 17
16 9 13 13 16 19 19 17
12 10 14 15 18 18 16 14
11 8 10 12 14 13 14 15
8 6 3 7 9 11 12 12.
Code: % Given image
image = [12 6 5 13 14 14 16 15;
11 10 8 5 8 11 14 14;
9 8 3 4 7 12 18 19;
10 7 4 2 10 12 13 17;
16 9 13 13 16 19 19 17;
12 10 14 15 18 18 16 14;
11 8 10 12 14 13 14 15;
8 6 3 7 9 11 12 12];
disp('8x8 Grid:');
disp(reshape(equalized_image, 8, 8));
Results:
Task No 3: Is the histogram equalization operation idempotent? That is, is
performing histogram equalization twice the same as doing it just once?
Code:
% Read an example image
original_image = imread('cameraman.tif');
subplot(1, 3, 2);
imshow(equalized_image_1);
title('Equalized Image (Once)');
subplot(1, 3, 3);
imshow(equalized_image_2);
title('Equalized Image (Twice)');
Result:
Code:
% Read the "cameraman.tif" image
c = imread('cameraman.tif');
subplot(1, 2, 2);
imshow(equalized_image);
title('Equalized Image');
Result: