www.gusucode.com > Adaboost算法训练人脸图像和非人脸图像,通过迭代得到由多个弱分类器组合而成的强分类器,实现图片里的人脸检测。 > Adaboost算法训练人脸图像和非人脸图像,通过迭代得到由多个弱分类器组合而成的强分类器,实现图片里的人脸检测。/myfacedet02/likelihood2class.m

    function classes = likelihood2class(likelihoods)
%
% LIKELIHOODS TO CLASSES
%
% classes = likelihood2class(likelihoods)
%
%  Find the class assignment of the samples from the likelihoods
%  'likelihoods' an NxD matrix where N is the number of samples and
%  D is the dimension of the feature space. 'likelihoods(i,j)' is
%  the i-th samples likelihood of belonging to class-j.
%
%  'classes' contains the class index of the each sample maximum likelihood
%
% Bug Reporting: Please contact the author for bug reporting and comments.
%
% Cuneyt Mertayak
% email: cuneyt.mertayak@gmail.com
% version: 1.0
% date: 21/05/2007
%

[sample_n,class_n] = size(likelihoods);
maxs = (likelihoods==repmat(max(likelihoods,[],2),[1,class_n]));

classes=zeros(sample_n,1);
for i=1:sample_n
	classes(i) = find(maxs(i,:),1);
end