我在下面有这个函数,但是循环if
内的语句for
不起作用。我试过<=
而不是<
and also round()
,但它们没有用。
function points1=tracker(count1,points1,u,v,I2)
for j=1:count1
if (points1(1,j) < size(u,1))&&(points1(2,j) < size(u,2))
points1(1,j)= points1(1,j)+v(points1(1,j),points1(2,j));
points1(2,j)= points1(2,j)+u(points1(1,j),points1(2,j));
I2(round(points1(1,j)),round(points1(2,j)))=255;
else
points1(:,j)=[];
count1=count1-1;
j=j-1;
end
end
figure, imshow(I2)
end