Problem with shadow removal operation
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I wrote matlab code for removing shadows but got the errorneous output. Can anyone please review my code and suggest the possible solutions. I am attaching the input output image and the reference paper is given in the link. <https://jivp-eurasipjournals.springeropen.com/articles/10.1186/s13640-017-0198-x >
function shadowremoval()
fontSize=14;
image=imread('inputimage.jpg');
image1=imread('foregroundimage.jpg');
image=imresize(image,[244 324]);
image1=imresize(image1,[244 324]);
% image=imresize(image,[406 646]);
% Do color conversion from rgb to hsv
x=rgb2hsv(image);
y=rgb2hsv(image1);
% Split the hsv component to h,s,v value
Hx = x(:,:,1);
Sx = x(:,:,2);
Vx = x(:,:,3);
Hy = y(:,:,1);
Sy = y(:,:,2);
Vy = y(:,:,3);
% Calculate a difference between this frame and the background.
dh=(abs(double(Hx) - double(Hy)));
ds1=(abs(double(Sx) - double(Sy)));
dv1=(abs(double(Vx) - double(Vy)));
figure;
subplot(3, 3, 1);
imshow(image1, []);
title('Inputimage', 'FontSize', fontSize);
subplot(3, 3, 2);
imshow(image, []);
title('Referenceimage', 'FontSize', fontSize);
subplot(3, 3, 3);
imshow(dh, []);
title('dh', 'FontSize', fontSize);
subplot(3, 3, 4);
imshow(ds1, []);
title('ds1', 'FontSize', fontSize);
subplot(3, 3, 5);
imshow(dv1, []);
title('dv1', 'FontSize', fontSize);
de_shadow=cat(3,dh,ds1,dv1);
%
% Perform the 'swt'
[as,hs,vs,ds] = swt2(ds1,2,'haar');
[av,hv,vv,dv] = swt2(dv1,2,'haar');
%
% %Compute the skewness value of 'swt of v'
sav=skewness(av(:));
shv=skewness(hv(:));
svv=skewness(vv(:));
sdv=skewness(dv(:));
%Compute the skewness value of 'swt of s'
sas=skewness(as(:));
shs=skewness(hs(:));
svs=skewness(vs(:));
sds=skewness(ds(:));
% %Perform the thresholding operation
b=(av>=sav);
c=(hv>=shv);
d=(vv>=svv);
e=(dv>=sdv);
%
f=(as>=sas);
g=(hs>=shs);
h=(vs>=svs);
i=(ds>=sds);
%
j=(b&f);
k=(c&g);
l=(d&h);
m=(e&i);
%Perform the inverse 'swt'operation
recv = iswt2(b,c,d,e,'haar');
recs= iswt2(j,k,l,m,'haar');
de_shadow1=cat(3,dh,recs,recv);
subplot(3, 3, 6);
imshow(de_shadow1, []);
title('deshadow1', 'FontSize', fontSize);
mask1=hsv2rgb(de_shadow1);
mask=rgb2gray(mask1);
mask=im2bw(mask);
subplot(3, 3, 7);
imshow(mask, []);
title('Grayoutput', 'FontSize', fontSize);
impixelinfo();
end
4 Commenti
Image Analyst
il 29 Dic 2017
If you expect us to extract the images out of the pdf then give us the code for doing that. Otherwise attach the jpg images like I originally wanted.
Risposte (0)
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!