-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathprob2.m
More file actions
39 lines (31 loc) · 646 Bytes
/
prob2.m
File metadata and controls
39 lines (31 loc) · 646 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
clear;
%Importing image
img = imread('2.JPG');
[m, n, k] = size(img);
%Computing gamma transformation for three different gamma.
gamma = 5;
gamma1 = 2;
gamma2 = .5;
fimg = img;
fimg1 = img;
img2 = double(img);
fimg2 = img;
for i = 1:3
fimg(:,:,i) = img(:,:,i) .^ gamma;
fimg1(:,:,i) = img(:,:,i) .^ gamma1;
fimg2(:,:,i) = img2(:,:,i) .^ gamma2;
end
%Displaying the result
figure,
subplot(2,2,1),
imshow(img);
title('Original Image');
subplot(2,2,2),
imshow(fimg);
title('Transform Image(Gamma=5)');
subplot(2,2,3),
imshow(fimg1);
title('Transform Image(Gamma=2)');
subplot(2,2,4),
imshow(fimg2);
title('Transform Image(Gamma=.5)');