📄 shadowremoval.m
字号:
clear
F=(imread('C:\Downloads\PCA_based Face Recognition System\TestDatabase\1.jpg'));% feeding input matrix
% F=rgb2gray(F); % change bmp into gray-level image.
% imshow(F);
[row,col]=size(F);% size of image
U=zeros(row,col);% internal activity matrix
Y=zeros(row,col);% output matrix
K=[1 1 1;1 0 1;1 1 1];% Convolutions kernel matrix;
L=zeros(row,col);% linking matrix L=Step(Y convolution K)
Theta=ones(row,col)*0.9; % threshold matrix
Quo=zeros(row,col);
Seg=zeros(row,col);
Inter=Y;
Re=Seg;
Beta=0.8;
Delta=1/256;
minVal=0.004;
DeltaMatrix=Delta*ones(row,col);
F=((1-minVal)/255)*double(F)+0.00004;%nonilize input matrix
imshow(F);
%-------------------------------------------------------------
% Inter=Y+1;
while (1)% if not all neuron have fired;
L=hardlim(conv2(Y,K,'same')-1);
Inter=Y;
U=F.*(1+Beta*L);
Y=hardlim(U-Theta);
Seg=Seg+Y.*Theta;
Theta=Theta+Y*1000;
Theta=Theta-Delta;
% Quo=Quo+Y;
Quo=F./Seg;
% imshow(Quo);
if Theta>1
break;
end;
end;
imshow(Quo);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -