function [css center]=extr_symb(cch,tstart,xc0,yc0,q1,ddy,tstop) % if tstop==0 % tmax=50e3; % else % tmax=tstop; % end tmax=tstop; t0=1000; [vv i_end] = min(abs(cch(:,1)-tmax)); [vv i_start] = min(abs(cch(:,1)-(tstart-t0))); %nev=size(cch,1); nev=i_end-i_start; css=zeros(nev,6); %tstart=124093; dx=15; dy=ddy; %q1=4; %y displacement to compensate for center in heart symbols only %xc0=35; %yc0=37; yedge=120; j0=find(cch(:,1)>=tstart-t0 & cch(:,1)<=tstart+t0 & cch(:,4)>=xc0-dx & cch(:,4)<=xc0+dx & cch(:,5)>=yc0-dy & cch(:,5)<=yc0+dy); xc=round(mean(cch(j0,4))); yc=round(mean(cch(j0,5))); j1=max(j0); j2=length(j0); css(1:length(j0),:)=cch(j0,:); center=zeros(length(j0),2); center(:,1)=xc; center(:,2)=yc; j=j1; a=0.0; while yc=xc-dx & cch(j,4)<=xc+dx & cch(j,5)>=yc-dy & cch(j,5)<=yc+dy) if((cch(j,4)-xc)^2+(cch(j,5)-yc)^2 <= dy^2) j2=j2+1; css(j2,:)=cch(j,:); k=find(css(:,1)>=cch(j,1)-t0); xcnew=round(a*xc+(1-a)*mean(css(k,4))); ycnew=round(a*yc+(1-a)*mean(css(k,5)))+q1; %if xcnew>xc xc=xcnew; yc=ycnew; %end center(j2,1)=xc; center(j2,2)=yc; end j=j+1; end css=css(1:j2,:); css(:,4)=css(:,4)-center(:,1)+16; css(:,5)=css(:,5)-center(:,2)+16; t1=css(1,1); te=css(end,1); % if te-t1>tmax % kk=find(css(:,1)>=t1 & css(:,1)<=t1+tmax); % css=css(kk,:); % end