# how to solve subsrcipt indices problem in iswt operation

2 views (last 30 days)
SHOBA MOHAN on 2 Jan 2018
Commented: SHOBA MOHAN on 2 Jan 2018
I got the following error while computing inverse iswt operation.'Subscript indices must either be real positive integers or logicals.' I check the index by running 'whose variable' syntax and confirmed that the input index are logical. Please any one provide your valuable guidance.
image=imresize(image,[244 324]);
image1=imresize(image1,[244 324]);
% 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(Hx- Hy);
ds1=abs(Sx- Sy);
dv1=abs(Vx- Vy);
% 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'
sav1=skewness(av(:));
shv1=skewness(hv(:));
svv1=skewness(vv(:));
sdv1=skewness(dv(:));
%Perform the thresholding operation
for i = 1:244
for j = 1:324
b=(av(i,j)>=sav1);
c=(hv(i,j)>=shv1);
d=(vv(i,j)>=svv1);
e=(dv(i,j)>=sdv1);
recv = iswt2(b,c,d,e,'haar');
end
end
SHOBA MOHAN on 2 Jan 2018
I followed the algorithm given in the paper for detecting and removing shadows. I have done till shadow detection thresolding part and shadow removal yet to be done. Can you please check whether i coded correctly the algorithms? what is wrong with that code? provide your suggestion.

Walter Roberson on 2 Jan 2018
In newer versions, the code instead complains that the first input was logical when real finite double values were expected.
SHOBA MOHAN on 2 Jan 2018
Thanks Walter. Now, the iswt syntax works. I have included the threshold for shadow removal as per algorithm given in the attached article also given the same code here.
sas=skewness(as(:));
shs=skewness(hs(:));
svs=skewness(vs(:));
sds=skewness(ds(:));
f=(as>=sas);
g=(hs>=shs);
h=(vs>=svs);
z=(ds>=sds);
k = 0 + (b&f);
l = 0 + (c&g);
m = 0 + (d&h);
n = 0 + (e&z);
recs= iswt2(k,l,m,n,'haar');
I am attaching the 'recs','recv' and output image for your kind reference. It is noticed that shadow presents in the'output image'. Can you suggest me why shadow presents in output though we applied shadow removal threshold.