Indicate a new quiver for each lopp

2 vues (au cours des 30 derniers jours)
승곤 유
승곤 유 le 12 Mai 2022
Commenté : Matt J le 12 Mai 2022
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

Réponse acceptée

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

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Vector Fields 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!

Translated by