【正文】
function m_image_xb_Callback(hObject, eventdata, handles)% hObject handle to m_image_xb (see GCBO)% eventdata reserved to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)img_src=getappdata(,39。img_src39。)。 x=rgb2gray(img_src)。 %真彩色圖像轉(zhuǎn)化為灰度圖像 [cA,cH,cV,cD]=dwt2(x,39。db139。)。 %對圖像進行單層分解,小波為bd1 A=upcoef2(39。a39。,cA,39。db139。,1)。 H=upcoef2(39。h39。,cH,39。db139。,1)。 V=upcoef2(39。v39。,cV,39。db139。,1)。 D=upcoef2(39。d39。,cD,39。db139。,1)。 %圖像編碼 subplot(221)。image(wcodemat(A,192))。 subplot(222)。image(wcodemat(H,192))。 subplot(223)。image(wcodemat(V,192))。 subplot(224)。image(wcodemat(D,192))。 img_src=idwt2(cA,cH,cV,cD,39。db139。)。 %對分解的細節(jié)系數(shù)執(zhí)行單層重構(gòu),小波為db1 axes()。imshow(img_src)。% function m_file_open_Callback(hObject, eventdata, handles)% hObject handle to m_file_open (see GCBO)% eventdata reserved to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) [filename, pathname] = uigetfile( ... {39。*.bmp。*.jpg。*.png。*.jpeg39。, 39。Image Files (*.bmp, *.jpg, *.png, *.jpeg)39。 ... 39。*.*39。, 39。All Files (*.*)39。}, ... 39。Pick an image39。)。 if isequal(filename,0) || isequal(pathname,0), return。 end axes()。 fpath=[pathname filename]。 img_src=imread(fpath)。 imshow(img_src)。 setappdata(,39。img_src39。,img_src)。 % function m_file_save_Callback(hObject, eventdata, handles)% hObject handle to m_file_save (see GCBO)% eventdata reserved to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)[filename, pathname] = uiputfile({39。*.bmp39。,39。BMP files39。39。*.jpg。39。,39。JPG files39。}, 39。Pick an Image39。)。 if isequal(filename,0) || isequal(pathname,0) return。%如果點了“取消” else fpath=fullfile(pathname, filename)。%獲得全路徑的另一種方法 end img_src=getappdata(,39。img_src39。)。%取得打開圖片的數(shù)據(jù)imwrite(img_src,fpath)。%保存圖片 % function m_file_exit_Callback(hObject, eventdata, handles)% hObject handle to m_file_exit (see GCBO)% eventdata reserved to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) close()。 27