% Flow pattern visualisation from PIV data, by Xiangyu LI,April 26, 2014

clear all
close all
clc

tic;

% Read png files----------------------------------------------
filepath = './ssat_animation/';
filepath1 = './ssat_animation/';
file = dir([filepath,'*.png']);
startframe = 1;
endframe = length(file);
%
movieName = 'evolution.avi';
% create AVI object-------------------------------------------------------
%vidObj = VideoWriter([filepath1,'PTV_Runningaverage_50Hz.avi']);
vidObj = VideoWriter([filepath1, movieName]);
vidObj.Quality = 100;
vidObj.FrameRate = 1;
open(vidObj);


for i = startframe:endframe
    filename = file(i).name
    plotimage = imread([filepath,filename]);
    writeVideo(vidObj,plotimage);
    
end

% save as AVI file, and open it using system video player----------------
close(vidObj);
%winopen([filepath1,'PTV_Runningaverage_50Hz.avi']);

toc;

