function varargout = txcl(varargin)
%TXCL M-file for txcl.fig
% TXCL, by itself, creates a new TXCL or raises the existing
% singleton*.
%
% H = TXCL returns the handle to a new TXCL or the handle to
% the existing singleton*.
%
% TXCL('Property','Value',...) creates a new TXCL using the
% given property value pairs. Unrecognized properties are passed via
% varargin to txcl_OpeningFcn. This calling syntax produces a
% warning when there is an existing singleton*.
%
% TXCL('CALLBACK') and TXCL('CALLBACK',hObject,...) call the
% local function named CALLBACK in TXCL.M with the given input
% arguments.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help txcl
% Last Modified by GUIDE v2.5 16-Jul-2016 20:06:54
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @txcl_OpeningFcn, ...
'gui_OutputFcn', @txcl_OutputFcn, ...
'gui_LayoutFcn', [], ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before txcl is made visible.
function txcl_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin unrecognized PropertyName/PropertyValue pairs from the
% command line (see VARARGIN)
% Choose default command line output for txcl
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes txcl wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = txcl_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --------------------------------------------------------------------
function Untitled_1_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function Untitled_2_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function Untitled_3_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function Untitled_4_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function Untitled_5_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function Untitled_6_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function Untitled_31_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_31 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
clear
I=imread('dog.jpg');
[X,map]=rgb2ind(I,0.1);
nbcol=size(map,1);
colormap(pink(nbcol));
cod_X=wcodemat(X,nbcol);
[ca1,ch1,cv1,cd1]=dwt2(X,'db1');
cod_ca1=wcodemat(ca1,nbcol);
cod_ch1=wcodemat(ch1,nbcol);
cod_cv1=wcodemat(cv1,nbcol);
cod_cd1=wcodemat(cd1,nbcol);
subplot(1,1,1),image([cod_ca1,cod_ch1;cod_cv1,cod_cd1]);title('对dog索引图像的1次小波分解')
% --------------------------------------------------------------------
function Untitled_32_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_32 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
clear
I=imread('dog.jpg');
[X,map]=rgb2ind(I,0.1);
nbcol=size(map,1);
colormap(pink(nbcol));
cod_X=wcodemat(X,nbcol);
[ca1,ch1,cv1,cd1]=dwt2(X,'db1');
[ca2,ch2,cv2,cd2]=dwt2(ca1,'db1');
cod_ca2=wcodemat(ca2,nbcol);
cod_ch2=wcodemat(ch2,nbcol);
cod_cv2=wcodemat(cv2,nbcol);
cod_cd2=wcodemat(cd2,nbcol);
subplot(1,1,1),image([cod_ca2,cod_ch2;cod_cv2,cod_cd2])
title('对dog索引图像的2次小波分解')
% --------------------------------------------------------------------
function Untitled_33_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_33 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
clear
I=imread('dog.jpg');
[X,map]=rgb2ind(I,0.1);
nbcol=size(map,1);
colormap(pink(nbcol));
cod_X=wcodemat(X,nbcol);
[ca1,ch1,cv1,cd1]=dwt2(X,'db1');
a0=idwt2(ca1,ch1,cv1,cd1,'db1',size(X));
a0=wcodemat(a0,nbcol);
subplot(1,1,1),image(a0)
title('对dog索引图像的第一层重构')
% --------------------------------------------------------------------
function Untitled_34_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_34 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
clear
I=imread('dog.jpg');
[X,map]=rgb2ind(I,0.1);
nbcol=size(map,1);
colormap(pink(nbcol));
cod_X=wcodemat(X,nbcol);
[ca1,ch1,cv1,cd1]=dwt2(X,'db1');
[ca2,ch2,cv2,cd2]=dwt2(ca1,'db1');
a0=idwt2(ca2,ch2,cv2,cd2,'db1',size(X));
a0=wcodemat(a0,nbcol);
subplot(1,1,1),image(a0)
title('对dog索引图像的第二层重构')
% --------------------------------------------------------------------
function Untitled_25_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_25 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
I=imread('dog.jpg');
V=0.02;
noise1=imnoise(I,'gaussian',0,V);%加高斯噪声
subplot(2,2,1),imshow(noise1);title('加高斯噪声')
noise=0.1*randn(size(I));%加随机噪声
noise2=imadd(I,im2uint8(noise));
subplot(2,2,2),imshow(noise2);title('加随机噪声')
noise3=imnoise(I,'salt & pepper', 0.02);
subplot(2,2,3),imshow(noise3);title('加椒盐噪声')
noise4=imnoise(I,'speckle',0.06);
subplot(2,2,4),imshow(noise4);title('加乘性噪声')
% --------------------------------------------------------------------
function Untitled_26_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_26 (see GCBO)
% e