www.pudn.com > GaitRecognition.rar > normalization.asv, change:2012-11-03,size:1729b


clear; 
clc; 
tic; 
setPath; 
 
cd(dataBasePath);%进入数据目录,包含若干人的步态序列 
dataBaseDir=dir('.'); 
for xPerson=3:length(dataBaseDir)%遍历所有文件夹 
    cd(dataBaseDir(xPerson).name);%进入某人的步态序列目录 
     
    %xPersonDir=dir('.'); 
    for x_condition=1:5:length(xCondition)-4 
        cd([pwd '\' xCondition(x_condition:x_condition+4)]);%进入一个条件下的序列目录 
        cd([pwd '\' xAngle]);%进入90°视角的目录        
         
        allImages=dir('*.png'); 
        picSize=size(imread(allImages(1).name)); 
        for xImage=1:length(allImages)          
            rawPIC=imread(allImages(xImage).name);%读进图像 
            x=1; 
            y=1; 
            while(rawPIC(x,y)==0) 
                if x>=picSize(1) 
                    x=0; 
                    y=y+1; 
                end 
                x=x+1; 
            end 
            leftx=y;%找到left点即退出 
 
            x=1; 
            y=picSize(2); 
            while(rawPIC(x,y)==0) 
                if x>=picSize(1) 
                    x=0; 
                    y=y-1; 
                end 
            x=x+1; 
            end 
            rightx=y;%找到bottom点即退出 
 
            picResize=rawPIC(40:picSize(1)-40,leftx:rightx);%重构后的图像 
            %保存图片 
           % imwrite(picResize,[normalizationPath dataBaseDir(xPerson).name '\规格化',int2str(xImage),'.png'],'png');   
           imwrite(picResize,[strrep(pwd,dataBasePath,normalizationPath) '\' allImages(xImage).name],'png');   
        end 
        cd ..%从90°视角目录往上一层  
   cd ..%从一个条件下的序列目录往上一层  
   end 
cd ..%从某人步态序列目录往上一层 
end;% 
cd(rootPath); 
disp('normalization time:'); 
toc; 
clear;