I'm working with the code that I will show below and I keep on getting the error:
"Subscript indices must either be real positive integers or logicals.
Error in opticalflow2D (line 62)
f5 = X1(( ndxm.*cos(1)+ndxn.*sin(1) ));"
if true X1 = [0 0 0 0 0 1 0 0 0 0 00 0 0 0 0 1 0 0 0 0 00 0 0 0 0 1 0 0 0 0 00 0 0 0 0 1 0 0 0 0 00 0 0 0 0 1 0 0 0 0 01 1 1 1 1 1 1 1 1 1 10 0 0 0 0 1 0 0 0 0 00 0 0 0 0 1 0 0 0 0 00 0 0 0 0 1 0 0 0 0 00 0 0 0 0 1 0 0 0 0 00 0 0 0 0 1 0 0 0 0 0];if trueX2 = [0 0 0 0 0 1 0 0 0 0 00 0 0 0 0 1 0 0 0 0 00 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 01 1 1 1 1 1 1 1 1 1 10 0 0 0 0 1 0 0 0 0 00 0 0 0 0 1 0 0 0 0 00 0 0 0 0 1 0 0 0 0 00 0 0 0 0 1 0 0 0 0 00 0 0 0 0 1 0 0 0 0 00 0 0 0 0 0 0 0 0 0 0];
%imtool(X1)
%imtool(X2)
delta=1;
[fm,fn] = size(X1);
ndxm = 1+delta:fm-delta;
ndxn = 1+delta:fn-delta;
X1(ndxm)
f0 = X1(ndxm,ndxn);
fz = X2(ndxm,ndxn);
f1 = X1(ndxm,ndxn+delta);
f2 = X1(ndxm,ndxn-delta);
f3 = X1(ndxm+delta,ndxn);
f4 = X1(ndxm-delta,ndxn);
f5 = X1(( ndxm.*cos(1)+ndxn.*sin(1) ), ( ndxm.*sin(1)+ndxn.*cos(1) ));
f6 = X1(( ndxm.*cos(-1.)+ndxn.*sin(-1) ), ( ndxm.*sin(-1)+ndxn.*cos(-1) ));
endend
Thank you!!
Best Answer