Indicate a new quiver for each lopp

2 次查看(过去 30 天)
Hi I'm writing the code below and I'm wondering and I'm going to ask! I want to show a new quiver for each loop, but what do I need to change?
for q = 1:2:length(str2num)
a = char(str2num(q))
b = char(str2num(q+1))
imagea = imread(a)
imageb = imread(b)
size(imagea);
size(imageb);
for i=1:(w_xcount)
for j=1:(w_ycount)
max_correlation=0;
test_xmin=xgrid(i)-w_width/2;
test_xmax=xgrid(i)+w_width/2;
test_ymin=ygrid(j)-w_height/2;
test_ymax=ygrid(j)+w_height/2;
x_disp=0;
y_disp=0;
test_ima=imagea(test_xmin:test_xmax,test_ymin:test_ymax);
test_imb=imageb((test_xmin-x_disp_max):(test_xmax+x_disp_max),(test_ymin-y_disp_max):(test_ymax+y_disp_max));
correlation=normxcorr2(test_ima,test_imb);
[xpeak,ypeak]=find(correlation==max(correlation(:)));
%re-scaling
xpeak1=test_xmin+xpeak-wsize(1)/2-x_disp_max;
ypeak1=test_ymin+ypeak-wsize(2)/2-y_disp_max;
dpx(i,j)= xpeak1-xgrid(i);
dpy(i,j)= ypeak1-ygrid(j);
end
quiver(-dpx,dpy)
end
end

采纳的回答

Matt J
Matt J 2022-5-12
....
quiver(-dpx,dpy); hold on
end
end
hold off
  4 个评论
Matt J
Matt J 2022-5-12
You can direct the plot to appear in the axis "ax" of your choice with the syntax,
Matt J
Matt J 2022-5-12
Or, perhaps,
....
figure; quiver(-dpx,dpy);
end
end

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Vector Fields 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by