% Sequential clustering algorithm for moving objects % RvdM, February, 2008 clear MAXHYP MAXFIL HYP HYP2 KAL NHYP PCLUTTER; global MAXHYP; % maximum number of hypotheses global MAXFIL; % maximum number of filters global HYP HYP2; % array of active hypotheses global KAL; % array of Kalman filters global NHYP; % number of active hypotheses global PCLUTTER; % probablity of clutter measurement global SIGMAX; % standard deviation of measurement noise in x direction global SIGMAY; % standard deviation of measurement noise in y direction global BOUND; % circular state space boundary global NKEEP; % number of hypotheses to keep in gating global ALPHA; % Pnew = ALPHA * Pexisting global PFACTOR; % hypothesis with P1 && tm(imeas)>tm(imeas-1) if ifirst ifirst=0; else for k=1:nobj_bak, visualize_remove_object(sobj(k)); remove_arrow(ha(:,k)); end end end if imeas>1 && tm(imeas)>tm(imeas-1) for k=1:HYP(i_best).nobj, idx=HYP(i_best).filter_id(k); % prepare sobj sobj(k).x=KAL(idx).xh(1); sobj(k).y=KAL(idx).xh(3); sobj(k)=visualize_add_object(sobj(k)); x1=KAL(idx).xh(1); y1=KAL(idx).xh(3); x2=KAL(idx).xh(1)+KAL(idx).xh(2); y2=KAL(idx).xh(3)+KAL(idx).xh(4); ha(:,k)=draw_arrow(x1, y1, x2, y2); %[xttt, yttt]=circle(sobj(k).x, sobj(k).y, SIGMA); %line(xttt, yttt); end end pause(sleep); %sobs=visualize_fade_object(sobs); %if imeas>1 && tm(imeas)>tm(imeas-1) % for k=1:HYP(i_best).nobj, % visualize_remove_object(sobj(k)); % % %% prepare sobj % %sobj(k).color=[0 0 0]; % %sobj(k).radius=0.01; % % %sobj(k)=visualize_add_object(sobj(k)); % %sobj(k)=visualize_fade_object(sobj(k)); % end %end title(['time = ' num2str(tm(imeas))]); if imeas>1 && tm(imeas)>tm(imeas-1) nobj_bak=HYP(i_best).nobj; end end end visualize_exit(); % stop visualization save -ascii result.dat RESULT