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

    
%Moving Window
zgray=1000*rand(240,240); % Assume this the image


deltax=18; % the shifting by x in each iteration
deltay=27; % the shifting by y in each iteration
XWindowWidth=18; % The size of the moving window
YWindowWidth=27;


[ImHeight,ImWidth, ImDepth]=size(zgray);
% Here i find the number of subwindows to be extracted from the moving window from all the image
NofXsubWindoes=1+floor((ImWidth-XWindowWidth)/deltax); 
%我明白这里是为什么了
%也就是为什么不是
%ImWidth/deltax
%而是这个形式
NofYsubWindoes=1+floor((ImHeight-YWindowWidth)/deltay);

% Prealocating the the resultant sliding window 
Temp24x24Imgae=(zeros(24,24,NofYsubWindoes*NofXsubWindoes));
TempCounter=1;

 for y=1:NofYsubWindoes
    for x=1:NofXsubWindoes
    Temp18x27Imgae(:,:,TempCounter)=zgray((deltay*(y-1)+1):deltay*(y-1) +...
YWindowWidth,(deltax*(x-1)+1):deltax*(x-1)+XWindowWidth);
    Temp18x27=Temp18x27Imgae(:,:,TempCounter);
    ii=bianli(Temp);
    ii=buzero(ii,1,1);
    F=tezhen1(ii); %为矩形特征值数组
    Feature=[Feature;F];
%这里是说什么呢
%应该很容易明白了
%就是将24*24的窗口,在图像上滑动,然后呢,拷贝一下窗口所覆盖区域的像素值
    TempCounter=TempCounter+1; 
    end

end