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

eyefinder.m

Go to the documentation of this file.
00001 % EYEFINDER find eyes in given images
00002 %   F = eyefinder(IMG, ci) finds both eyes in the frontal faces in IMG using
00003 %   the provided weights files for the left eye.  F = eyefinder(IMG, leftCi,
00004 %   rightCi) uses separate weights files for each eye.
00005 %
00006 %   F is an array of sructs, where each row contains the face's
00007 %   x, y, scale, and a vector of structs for each eye.  Each eye has fields
00008 %   x, y, scale, activation, and flag.
00009 %
00010 %   [F,P] = eyefinder(IMG, ci, F) and eyefinder(IMG, leftCi, rightCi, F)
00011 %   uses the flags for each eye in F to return the corresponding searched
00012 %   patches. F must be a structure returned by a previous eyefinder
00013 %   call, with each eye's flag either 0 or 1.
00014 %
00015 %   This function makes use of the mp_eyefinderMex mex file, which must
00016 %   be compiled with the eyefinder project.
00017 function [F, varargout] = eyefinder(img, ci, varargin)
00018   if nargin < 2
00019     error('Must input at least 2 arguments')
00020   end
00021 
00022   % First, make the image be a good image
00023   M = [];
00024   if ischar(img)
00025     [img, M] = imread(img);
00026   elseif ~isnumeric(img)
00027     error('First argument must be an image or image filename')
00028   end
00029   % make grayscale
00030   if ndims(img) == 3
00031     img = double(rgb2gray(img));
00032   elseif ~isempty(M)
00033     img = double(ind2gray(img,M));
00034   end
00035 
00036   img = double(img);
00037   if(max(max(img)) > 2)
00038     img = img./255;
00039   end
00040   % keyboard;
00041   % if nargin == 2
00042   ci2 = mirrorClassifier(ci);
00043   % end
00044 
00045   Fin = [];
00046 % Check arguments
00047 %  if nargin > 2
00048 %    if ~isstruct(varargin{1})
00049 %      error('Third argument must be a struct')
00050 %    end
00051 %    if nargin == 3
00052 %      % Check to see if we have to mirror the struct
00053 %      if isfield(varargin{1},'numClassifiers')
00054 %             ci2 = varargin{1};
00055 %      else
00056 %             ci2 = mirrorClassifier(ci);
00057 %             Fin = varargin{1};
00058 %      end
00059 %    elseif nargin == 4
00060 %      ci2 = varargin{1};
00061 %      Fin = varargin{2};
00062 %    else
00063 %      % Too many arguments
00064 %    end
00065 %  end
00066   if nargin > 2
00067           modestr = varargin{1}
00068         else
00069         modestr = 'wt_avg';
00070   end
00071 
00072   % determine if we will return patches or not
00073   if nargout == 1
00074     [F] = mp_eyefinderMex(ci, ci2, img, 0, modestr);
00075   elseif nargout == 2
00076     [F,varargout{1}] = mp_eyefinderMex(ci, ci2, img, 1, modestr);
00077   else
00078     error('Wrong number of outputs')
00079   end
00080 
00081 
00082 

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