Indicate a new quiver for each lopp

1 view (last 30 days)
승곤 유
승곤 유 on 12 May 2022
Commented: Matt J on 12 May 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

Accepted Answer

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

Sign in to comment.

More Answers (0)

Categories

Find more on Vector Fields in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!