www.pudn.com > wenlituxiangjiansuo.rar > OpenDatabaseTexture.m


function OpenDatabaseTexture(hObject,handles) 
dir_name = uigetdir('H:\'); 
addpath(dir_name); 
 
cd(dir_name);                        
filename = dir('*.jpg');            %get all the image file  
filename = [filename;dir('*.gif')]; 
filename = [filename;dir('*.tif')]; 
filename = [filename;dir('*.bmp')]; 
fileNumber = length(filename); 
 
level = 3; 
FV_Inquire = []; 
for m=1:fileNumber   
    FV_e =[]; 
    FV_std = []; 
    image1 = imread(filename(m).name); 
    if length(size(image1))==3 
        image1 = RGB2GRAY(image1); 
    end 
     
    [Yl,Yh] = dtwavexfm2(image1,level,'near_sym_b','qshift_b'); 
 
    sz = size(Yl); 
    FV_e(1) = sum(abs(Yl(:)))/sz(1)*sz(2); 
    FV_std(1) = std(abs(Yl(:))); 
 
    matric = []; 
    for i=1:level 
        for j=1:6 
            matric = Yh{i,1}(:,:,j); 
            sz = size(matric); 
            %FV_e((i-1)*6+1+j) = sum(abs(matric(:)))/(sz(1)*sz(2)); 
            %FV_std((i-1)*6+1+j) = std(abs(matric(:))); 
            FV_e((i-1)*6+j) = sum(abs(matric(:)))/(sz(1)*sz(2)); 
            FV_std((i-1)*6+j) = std(abs(matric(:))); 
        end 
    end 
     
    FV_Inquire(m,:)=[FV_e,FV_std]; 
end 
 
handles.fileNumber=fileNumber; 
handles.filename=filename; 
handles.FV_Inquire=FV_Inquire; 
 
%disp_white(handles,1); 
% --- Outputs from this function are returned to the command line.% Choose default command line output for image_search1 
handles.output = hObject; 
 
% Update handles structure 
guidata(hObject, handles); 
 
% UIWAIT makes image_search1 wait for user response (see UIRESUME) 
% uiwait(handles.figure1);