?? localhisteq3.m
字號:
function g=localhisteq3(f,m,n)
if nargin==1
m=3;n=3;
elseif nargin==2
n=m;
end
if(~(round(m/2)~=m/2) | ~round(n/2)~=n/2)
error(' is odd')
end
classin=class(f);
f=im2unit8(f);
den=m*n;
v=0:255;
[R,C]=size(f);
f=padarray(f,[m,n],'symmetric','both');
xg=(m+1)/2+1;
yg=(n+1)/2+1;
subimage=f(x0-1 : x0+m-2,y0-1 : y0+n-2);
histim=hist(double(subimage(:)),v);
xg=0;
for x=x0:R+(m+1)/2
histabove=hist(double(f(x-1,y0-1 : yo+n-2)),v)/den;
histblow=hist(double(f(x-+m-1,y0-1 : yo+n-2)),v)/den;
histim=histim-histabove+histblow;
histimhoriz=histim;
xg=xg+1;
yg=0;
for y=y0 : C+(n+1)/2
yg=yg+1;
histleft=hist(double(f(x : x+m-1,y-1)),v)/den;
histright=hist(double(f(x : x+m-1,y+n-1)),v)/den;
histimhoriz=histim-histleft+histright;
cdf=cumsum(histimhoriz);
value=f(x+(m+1)/2-1,y+(n+1)/2-1);
g(xg,yg)=cdf(double(value+1));
end
end
g=changeclass(classin,g);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -