|
Hello Fabian
One way to do it is not to include the zero vectors in the first place. You can scan through the flow field and exclude those of zero value from being plotted, like this:
function quiverTest(u,v)
% Initialise arrays
xx=[]; yy=[]; uu=[]; vv=[];
% Scan through all elements
for i=1:size(u,1)
for j=1:size(u,2)
if sqrt(u(i,j).^2+v(i,j).^2)~=0 % If it's a zero vector, ignore it, otherwise add it to the array
xx=[xx i];
yy=[yy j];
uu=[uu u(i,j)];
vv=[vv v(i,j)];
end
end
end
% Quiver and reverse the Y axis.
quiver(xx,yy,uu,vv);
set(gca,'YDir','reverse');
Hope this helps,
M
"Fab Braun" <f1braun@hsr.ch> wrote in message <hcsn0u$s36$1@fred.mathworks.com>...
> hi all!
>
> i'm dealing around with showing the optical flow of an image in a quiver plot.
> so far no problem, except I haven't found a solution yet to completely remove zero valued vectors from the quiver plot.
>
> the following i read somewhere:
> Vectors(Vectors == 0) = nan;
>
> bud this doesn't work 100%...because there is still a small point left everywhere i want to set these vectors to zero.
>
> any other ideas?
>
> thanks in advance!
> fabian
|