www.pudn.com > GetHSVfeature.rar > GetHSVfeature.m


function hsvfeature=GetHSVfeature(disk,imdir,Hd,Sd,Vd,class) 
%input should be like hsvfeature=GetHSVfeature('f:','\work\matlab\colorfeature\flowers\*.bmp',1,1,1,1)  
% note class should be a integer, denoting the class number a data belongs to 
hsvfeature=[]; 
feature=[]; 
 
images=dir(fullfile(disk,imdir)); % find all images within the folder specified (images is a structure) 
End=find(imdir=='*'); 
subimdir=imdir(1:End-1); 
 
for i=1:size(images,1) 
    fn=images(i).name; 
    image=sprintf('%s%s%s',disk,subimdir,fn); 
    fid=fopen(image,'r'); 
    if fid~=1 
       feature=Hsvfeature(image,Hd,Sd,Vd,class); 
       hsvfeature=[hsvfeature;feature];  
    end % if  
end % for i=1:size(images,1) 
 
% the result will be a M*N matrix, where M is the number of samples, and N 
% is the dimension of HSV feature of each sample