%%
%%
%%
%%
%%
function drawflow(img1,img2)
global aviobj;

global image_data;
a=binsvector_of_image(img1);
b=binsvector_of_image(img2);
%figure
%axis([1,1,320,280]);
%axis off;
%line([1,320,320,1,1],[1,1,240,240,1]);
data=double(imread(img1));  %store the matrix
s=size(data);      %store the size   
image_data=zeros(s(1),s(2),3);

for i=0:1:23
    y=[a(3*i+1),b(3*i+1)];
    x=[a(3*i+2),b(3*i+2)];
    if x(1)>0 & x(2)>0 & distance(x(1),x(2),y(1),y(2))>=4 
        drawpixels(img1,i);
        %line(x,y);
    end;
end


%axes('position',[1,1,320,280]);

% for i=1:1:20
% aviobj = addframe(aviobj,getframe);
% end;

fileName = 'temp.bmp';
    imwrite(image_data,fileName,'bmp');
    imgObj = imread(fileName,'bmp');
    frameObj = im2frame(imgObj);  
    aviobj = addframe(aviobj,frameObj);
    delete(fileName);

clf;
