-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathset1q5.m
More file actions
26 lines (26 loc) · 761 Bytes
/
set1q5.m
File metadata and controls
26 lines (26 loc) · 761 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
clear all;
close all;
of=imread('embedded_square_noisy_512.tif');
f=double(of);
ws=7;
pd=(ws-1)/2;
start=ws-pd;
f=padarray(f,[pd pd]);
[row,col]=size(f);
for i=start:ws:row-pd
for j=start:ws:col-pd
im=f(i-pd:i+pd,j-pd:j+pd);
s=0;
enimg=zeros(ws,ws);
for a=1:256
b=(im==a);
s=s+sum(b(:));
out(a)=ceil(255*s/(ws*ws));
enimg=enimg+ out(a)*b;
end
outres(i-start+1:i-start+ws,j-start+1:j-start+ws)=enimg;
end
end
outres=uint8(outres);
figure,subplot(1,2,1),imshow(of),title('Original Image');
subplot(1,2,2),imshow(outres),title('After Local Histogram Equalization');