function [begin,endd,gravity,maxim,intf,compac,target]=dt_phi(fil,P) % Syntax: [begin,endd,gravity,maxim,intf,compac,target]=dt_phi(fil,P); % or: [begin,endd,gravity,maxim,intf,compac,target]=dt_phi(fil); % % Reading one target and interpolation function in Frederic Bimbot's temporal % decomposition xxx.ph? files. % fil - file descriptor (file must be opened in read mode) % P - number of coefficients in vector (optional). Default 10. % % begin - first frame of interpolation function (in Matlab indexing) % endd - last frame of interpolation function (in Matlab indexing) % gravity - center of gravity of interpolation function (in Matlab indexing) % maxim - index of maximum of interpolation function (in Matlab indexing) % intf - interpolation function. Line vector of length end-begin+1. % compac - compacity of interpol function. % target - target. Column vector of length P. if nargin==1 P=10; end %%% reading and checking the end of file [begin, ok]=fread(fil, 1, 'short'); if ok ~= 1, begin=-1; endd=0; gravity=0; maxim=0; intf=[]; compac=0; target=[]; return; end %%% well, can read the rest: endd=fread(fil, 1, 'short'); gravity=fread(fil, 1, 'short'); maxim=fread(fil, 1, 'short'); %%% everything is already "matlab-indexed" !!! len=endd-begin+1; intf=fread(fil, [1,len], 'double'); compac=fread(fil, 1, 'double'); target=fread(fil, [P, 1], 'double'); %%% that should be all...