function vision_engine_d(object1,object2,object3) %executes seeing strategy for dynamic situation %with cluttered background and speckle noise %object1, ... are l1xl2 binary arrays %1.ENTER. %opening frames page1 pause(2) close page2 pause(2) close page3d pause(2) close %2.SELECT OBJECT [l1,l2]=size(object1);d=min(l1,l2); [X2,X1]=meshgrid(1:l2,(1:l1)'); %select which object trueobject=sum(rand(1)<[1/3,2/3,1]); object=eval(['object',num2str(trueobject)]); %3.GET CENTER,SCALE (RADII) OF EACH OBJECT c1=center(object1); c2=center(object2); c3=center(object3); c=[c1;c2;c3]; r1=scale(object1); r2=scale(object2); r3=scale(object3); r=[r1, r2,r3]; 'IT WILL TAKE A WHILE TO BUILD THE SCENE...' %4. SELECT SPECKLE LEVEL speckle pause close load V %5.SELECT NUMBER OF CLUTTER ITEMS IN CLUTTERED BACKGROUND numobj pause close load W N=floor(N)+1; %6.PREPARE BACKGROUND n=20; [l1,l2]=size(object); %and simulates clutter with elongated objects, depth in l1xl2-scene %total depth = n, N objects of lengths <=l and %widths <= w scene =zeros(l1,l2);depths=n.*ones(l1,l2); w=7;l=5; ws=[-round(w/2):round(w/2)]; ls=[-round(l/2):round(l/2)]; %start simulating clutter for i=1:N x1=ceil(l1*rand(1)); x2=ceil(l2*rand(1)); depth=ceil(n*rand(1)); v1=round(x1+ls*(1-depth/n));v2=round(x2+ws*(1-depth/n)); v1=max(1,min(v1,l1));v2=max(1,min(v2,l2)); new=zeros(l1,l2);new(v1,v2)=ones(length(v1),length(v2)); scene=scene | new; depths(v1,v2) = min(depths(v1,v2), ones(length(v1),length(v2)).* depth); end scene=diffeo(scene,5); scene=scene.*70; %8.INSERT MOVING OBJECT INTO MOVIE FRAMES M=zeros(l1,l2,n); for t=1:n %compute depth for obscuration obscure=depths < (n-t).*ones(l1,l2); newobject=fastintm(object,n/t); M(:,:,t)=newobject.*(1-obscure)+(obscure | newobject<1).*scene; %degrade by speckle noise M(:,:,t)=M(:,:,t).*(1+.3.*(rand(l1,l2)-.5)); end %7.PLAY MOVIE WITH INFERENCE: BAYESIAN RECOGNITION OF OBJECT %introduce posterior energies E=zeros(1,3); object1=object1>20;object2=object2>20;object3=object3>20; names=['none ';'tank ';'truck']; image(zeros(l1,l2)) text(l1/4,l2/4,'TRUTH:','FontSize',24) text(l1/4,l2/2,names(trueobject,:),'FontSize',24) pause(2) close for t=2:n for alpha = 1:3 subplot(2,2,1),image(2.*M(:,:,t)) title('OBSERVED IMAGE') % implement saccadic search in dynamic setting fovea=20l1.*ones(l1,l2);XI=(1-M).*XI+M.*l1.*ones(l1,l2); M=XIl2.*ones(l1,l2);YI=(1-M).*YI+M.*l2.*ones(l1,l2); M=YI