视频运动矢量图matlab

preMV = csvread('000000_10_9.txt'); %读运动矢量
curMV = csvread('000000_10_10.txt');

A = imread('000000_9.png');
[m,n]=size(A);
figure;
imshow('000000_9.png');

[X,Y]=meshgrid(1:16:n,1:16:m);
hold on;
GxAll = reshape(preMV(:,1), n, m); GxAll = GxAll';
GyAll = reshape(preMV(:,2), n, m); GyAll = GyAll';
Gx = GxAll(1:16:m,1:16:n);
Gy = GyAll(1:16:m,1:16:n);
quiver(X,Y,Gx,Gy,1,'color','b'); %利用quiver画图
% quiver(X,Y,Gx,Gy);
axis on;


如果像按照原比例画图,直接将这条语句改为:

quiver(X,Y,Gx,Gy,0,'color','b'); %利用quiver画图
 Matlab Spec中S的定义:

   quiver(U,V,S) or quiver(X,Y,U,V,S) automatically scales the
    arrows to fit within the grid and then stretches them by S.  Use
    S=0 to plot the arrows without the automatic scaling.

但是这个视觉效果没有设置为1的好!

你可能感兴趣的:(Matlab)