The Machine Perception Toolbox

[Introduction]- [News]- [Download]- [Screenshots]- [Manual (pdf)]- [Forums]- [API Reference]- [Repository ]

 

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

show_search_locations.m

Go to the documentation of this file.
00001 function show_search_locations(img, F,file, gaussian)
00002   if length(F) == 0
00003     return;
00004   end
00005   sizes = [];
00006   for i = 1:length(F)
00007     sizes = [sizes; F(i).left_eye_size; F(i).right_eye_size];
00008   end
00009   sizes = unique(sizes);
00010   nsizes = length(sizes);
00011   subplot(length(F),nsizes,1)
00012   nplots = length(F) * nsizes;
00013   maxv = 8;
00014   voff = -2;
00015   %keyboard
00016   for i=1:length(F)
00017     [m, leftmaxind] = max(F(i).left_eye_activation);
00018     xoff = max(1,round(F(i).x - (F(i).size * 0.2)));
00019     yoff = max(1,round(F(i).y - (F(i).size * 0.2)));
00020     c = img(yoff:min(round(F(i).y + (F(i).size * 1.2)),size(img,1)),...
00021       xoff:min(round(F(i).x + (F(i).size * 1.2)),size(img,2)),:);
00022     for k = 1:nsizes;
00023       subplot(length(F),nsizes,(i-1)*nsizes+k);
00024       imshow(c,[],'notruesize')
00025       msize = sizes(k);
00026       for m = 1:length(F(i).left_eye_size)
00027         if F(i).left_eye_size(m) == msize
00028           if F(i).left_eye_activation(m) < voff
00029             v = 1-min(1,-(F(i).left_eye_activation(m)-voff) / maxv);
00030             color = [v,v,1];
00031           else
00032             v = 1-min(1,(F(i).left_eye_activation(m)-voff) / maxv);
00033             color = [1,v,v];
00034           end       
00035           plen = F(i).left_eye_size(m)/4;
00036           ax = F(i).left_eye_x(m)-xoff+1; ay = F(i).left_eye_y(m)-yoff+1;
00037           p = patch([ax-plen, ax-plen, ax+plen, ax+plen],[ay-plen, ay+plen, ay+plen, ay-plen],color );
00038           set(p,'EdgeColor','none')
00039           if m == leftmaxind
00040             cross(F(i).left_eye_x(m)-xoff+1, F(i).left_eye_y(m)-yoff+1,plen);
00041           end
00042           %keyboard
00043         end
00044       end
00045       %for m = 1:length(F(i).right_eye_size)
00046         %if F(i).right_eye_size(m) == msize
00047         %  if F(i).right_eye_activation(m) < voff
00048         %    v = 1-min(1,(voff-F(i).right_eye_activation(m)) / maxv);
00049         %    color = [v,v,1];
00050         %  else
00051         %    v = 1-min(1,voff+F(i).right_eye_activation(m) / maxv);
00052         %    color = [1,v,v];
00053         %  end      
00054         %  plen = F(i).right_eye_size(m)/2;
00055         %  ax = F(i).right_eye_x(m)-xoff+1; ay = F(i).right_eye_y(m)-yoff+1;
00056         %  p = patch([ax-plen, ax-plen, ax+plen, ax+plen],[ay-plen, ay+plen, ay+plen, ay-plen],color );
00057         %  set(p,'EdgeColor','none')
00058         %end
00059       %end
00060     end
00061   end
00062   if exist('file')
00063     [rebx,reby,rebo] = ginput (1);
00064     switch( rebo ),
00065       case 32 % spacebar move to next
00066         return;
00067       case 115 % s save graph
00068         for i=1:length(F)
00069           [m, leftmaxind] = max(F(i).left_eye_activation);
00070           xoff = max(1,round(F(i).x - (F(i).size * 0.2)));
00071           yoff = max(1,round(F(i).y - (F(i).size * 0.2)));
00072           c = img(yoff:min(round(F(i).y + (F(i).size * 1.2)),size(img,1)),...
00073             xoff:min(round(F(i).x + (F(i).size * 1.2)),size(img,2)),:);
00074           for k = 1:nsizes;
00075             figure(2);
00076             imshow(c,[],'notruesize')
00077             msize = sizes(k);
00078             for m = 1:length(F(i).left_eye_size)
00079               if F(i).left_eye_size(m) == msize
00080                 if F(i).left_eye_activation(m) < voff
00081                   v = 1-min(1,-(F(i).left_eye_activation(m)-voff) / maxv);
00082                   color = [v,v,1];
00083                 else
00084                   v = 1-min(1,(F(i).left_eye_activation(m)-voff) / maxv);
00085                   color = [1,v,v];
00086                 end         
00087                 plen = F(i).left_eye_size(m)/4;
00088                 ax = F(i).left_eye_x(m)-xoff+1; ay = F(i).left_eye_y(m)-yoff+1;
00089                 p = patch([ax-plen, ax-plen, ax+plen, ax+plen],[ay-plen, ay+plen, ay+plen, ay-plen],color );
00090                 set(p,'EdgeColor','none')
00091                 if m == leftmaxind
00092                   cross(F(i).left_eye_x(m)-xoff+1, F(i).left_eye_y(m)-yoff+1,plen);
00093                 end
00094               end
00095             end
00096             if (exist('gaussian'))
00097               eval(['print -dpng ScalePlots/ScalePlots_', file,'_',F(i).image ,sprintf('_guassian_%d',msize), '.png']);
00098             else
00099               eval(['print -dpng ScalePlots/ScalePlots_', file,'_',F(i).image ,sprintf('_%d',msize), '.png']);  
00100             end
00101           end
00102         end
00103         close;
00104         return;
00105     end
00106   end
00107 end
00108       
00109       
00110       
00111   
00112 function cross(x,y,plen)
00113   H = line([x-plen*3,x+plen*3], [y,y]);
00114   set(H,'Color',[0 1 0]);
00115   set(H,'LineWidth',3);
00116   H = line([x,x], [y-plen*3,y+plen*3]);
00117   set(H,'Color',[0 1 0]);
00118   set(H,'LineWidth',3);

Generated on Mon Nov 8 17:07:52 2004 for MPT by  doxygen 1.3.9.1