how to solve subsrcipt indices problem in iswt operation
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
SHOBA MOHAN
le 2 Jan 2018
Commenté : SHOBA MOHAN
le 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=imread('referenceframe.jpg');
image1=imread('currentframe.jpg');
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
4 commentaires
Réponse acceptée
Walter Roberson
le 2 Jan 2018
In newer versions, the code instead complains that the first input was logical when real finite double values were expected.
3 commentaires
Walter Roberson
le 2 Jan 2018
Modifié(e) : Walter Roberson
le 2 Jan 2018
refimage=imread('referenceframe.jpg');
curimage1=imread('currentframe.jpg');
refimage=imresize(refimage,[244 324]);
curimage1=imresize(curimage1,[244 324]);
% Do color conversion from rgb to hsv
x=rgb2hsv(refimage);
y=rgb2hsv(curimage1);
% 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
b = 0 + (av >= sav1);
c = 0 + (hv >= shv1);
d = 0 + (vv >= svv1);
e = 0 + (dv >= sdv1);
recv = iswt2(b,c,d,e,'haar');
imagesc(recv)
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Computer Vision with Simulink dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!