From: niket on
In the code below wavelet and getCodeMatrix does't work....pleaase help

function varargout = frmMain(varargin)
% FRMMAIN M-file for frmMain.fig
% FRMMAIN, by itself, creates a new FRMMAIN or raises the existing
% singleton*.
%
% H = FRMMAIN returns the handle to a new FRMMAIN or the handle to
% the existing singleton*.
%
% FRMMAIN('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in FRMMAIN.M with the given input arguments.
%
% FRMMAIN('Property','Value',...) creates a new FRMMAIN or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before frmMain_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to frmMain_OpeningFcn via varargin.
%
% *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 frmMain

% Last Modified by GUIDE v2.5 26-Jun-2010 19:30:36

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @frmMain_OpeningFcn, ...
'gui_OutputFcn', @frmMain_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin & isstr(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 frmMain is made visible.
function frmMain_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 command line arguments to frmMain (see VARARGIN)

% Choose default command line output for frmMain
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes frmMain wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = frmMain_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;


% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
imageR=imread('Sunset.jpg');

% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
imageR=imread('Sunset.jpg');
subplot(2,3,1);
imageS=imshow(imageR);

% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)


% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)


% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)




imageR=imread('Sunset.jpg');
imageE=imread('Winter.jpg');

if size(imageR)~=size(imageE)
error('Size Mismatch!!');
else

[fusion]=wavelet(imageR,imageE,4,1,'bior1.1',0);
[M]=getCoMatrix(size(imageR),size(imageE));
[w]=wt2dc1(M,'bior1.1',0,4);
[i]=wt2dc2(w,'bior1.1',0,4);
subplot(2,3,5);
imshow(i);
end



function fusion = wavelet(im1,im2,nscales,consistency,wavefile,reflect)
nscales=4;
consistency=0;
reflect=0;
wavefile='bior1.1';
N=8;
load sumsin;
s=sumsin;
im1=imread('Sunset.jpg');
im2=imread('Winter.jpg');
if consistency==1
wavelet.fusion=consistency;
[c,l]= wavedec2(s,N,'bior1.1');
subplot(2,3,5);
imshow(c);
else
[c,l]= wavedec2(s,N,'bior1.1');
subplot(2,3,5);
imshow(c);
end
function w=wt2dscl(i, wavfile, reflect, nscales)
wavfile='bior1.1';
reflect=0;
nscales=4;
if consistency==1
wavelet.fusion=consistency;
[c,l]= wavedec2(s,N,'bior1.1');
subplot(2,3,5);
imshow(c);
else
[c,l]= wavedec2(s,N,'bior1.1');
subplot(2,3,5);
imshow(c);
end
[i]=M(im1,im2);

function M=getCoMatrix(M1,M2)
M = zeros(2); % 2x2 result matrix for binary image.
[r,c] = size(M);

for i=1:r
for j=1:c
v1 = M1(i,j) + 1 % Add one to binary image values to get Matlab indices.
v2 = M2(i,j) + 1;
M(v1,v2) = M(v1,v2) + 1; % Increment co-occurrence value.
end
end
function i =wt2dsc2(w, wavfile, reflect, nscales)
[C,S]=waverec2(w,'bior1.1',0,4);

% --- Executes during object creation, after setting all properties.
function popupmenu1_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end


% --- Executes on selection change in popupmenu1.
function popupmenu1_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns popupmenu1 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu1


% --- Executes on button press in pushbutton6.
function pushbutton6_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)



% --- Executes on button press in pushbutton7.
function pushbutton7_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)



% --- Executes on button press in pushbutton8.
function pushbutton8_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton8 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
imageE=imread('Winter.jpg');

% --- Executes on button press in pushbutton9.
function pushbutton9_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton9 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
imageE=imread('Winter.jpg');
subplot(2,3,3);
imageB=imshow(imageE);


% --- Executes on button press in pushbutton10.
function pushbutton10_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton10 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
From: Wayne King on
"niket " <niketmulye(a)yahoo.co.in> wrote in message <i06845$feg$1(a)fred.mathworks.com>...
> In the code below wavelet and getCodeMatrix does't work....pleaase help
>
> function varargout = frmMain(varargin)
> % FRMMAIN M-file for frmMain.fig
> % FRMMAIN, by itself, creates a new FRMMAIN or raises the existing
> % singleton*.
> %
> % H = FRMMAIN returns the handle to a new FRMMAIN or the handle to
> % the existing singleton*.
> %
> % FRMMAIN('CALLBACK',hObject,eventData,handles,...) calls the local
> % function named CALLBACK in FRMMAIN.M with the given input arguments.
> %
> % FRMMAIN('Property','Value',...) creates a new FRMMAIN or raises the
> % existing singleton*. Starting from the left, property value pairs are
> % applied to the GUI before frmMain_OpeningFunction gets called. An
> % unrecognized property name or invalid value makes property application
> % stop. All inputs are passed to frmMain_OpeningFcn via varargin.
> %
> % *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 frmMain
>
> % Last Modified by GUIDE v2.5 26-Jun-2010 19:30:36
>
> % Begin initialization code - DO NOT EDIT
> gui_Singleton = 1;
> gui_State = struct('gui_Name', mfilename, ...
> 'gui_Singleton', gui_Singleton, ...
> 'gui_OpeningFcn', @frmMain_OpeningFcn, ...
> 'gui_OutputFcn', @frmMain_OutputFcn, ...
> 'gui_LayoutFcn', [] , ...
> 'gui_Callback', []);
> if nargin & isstr(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 frmMain is made visible.
> function frmMain_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 command line arguments to frmMain (see VARARGIN)
>
> % Choose default command line output for frmMain
> handles.output = hObject;
>
> % Update handles structure
> guidata(hObject, handles);
>
> % UIWAIT makes frmMain wait for user response (see UIRESUME)
> % uiwait(handles.figure1);
>
>
> % --- Outputs from this function are returned to the command line.
> function varargout = frmMain_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;
>
>
> % --- Executes on button press in pushbutton1.
> function pushbutton1_Callback(hObject, eventdata, handles)
> % hObject handle to pushbutton1 (see GCBO)
> % eventdata reserved - to be defined in a future version of MATLAB
> % handles structure with handles and user data (see GUIDATA)
> imageR=imread('Sunset.jpg');
>
> % --- Executes on button press in pushbutton2.
> function pushbutton2_Callback(hObject, eventdata, handles)
> % hObject handle to pushbutton2 (see GCBO)
> % eventdata reserved - to be defined in a future version of MATLAB
> % handles structure with handles and user data (see GUIDATA)
> imageR=imread('Sunset.jpg');
> subplot(2,3,1);
> imageS=imshow(imageR);
>
> % --- Executes on button press in pushbutton3.
> function pushbutton3_Callback(hObject, eventdata, handles)
> % hObject handle to pushbutton3 (see GCBO)
> % eventdata reserved - to be defined in a future version of MATLAB
> % handles structure with handles and user data (see GUIDATA)
>
>
> % --- Executes on button press in pushbutton4.
> function pushbutton4_Callback(hObject, eventdata, handles)
> % hObject handle to pushbutton4 (see GCBO)
> % eventdata reserved - to be defined in a future version of MATLAB
> % handles structure with handles and user data (see GUIDATA)
>
>
> % --- Executes on button press in pushbutton5.
> function pushbutton5_Callback(hObject, eventdata, handles)
> % hObject handle to pushbutton5 (see GCBO)
> % eventdata reserved - to be defined in a future version of MATLAB
> % handles structure with handles and user data (see GUIDATA)
>
>
>
>
> imageR=imread('Sunset.jpg');
> imageE=imread('Winter.jpg');
>
> if size(imageR)~=size(imageE)
> error('Size Mismatch!!');
> else
>
> [fusion]=wavelet(imageR,imageE,4,1,'bior1.1',0);
> [M]=getCoMatrix(size(imageR),size(imageE));
> [w]=wt2dc1(M,'bior1.1',0,4);
> [i]=wt2dc2(w,'bior1.1',0,4);
> subplot(2,3,5);
> imshow(i);
> end
>
>
>
> function fusion = wavelet(im1,im2,nscales,consistency,wavefile,reflect)
> nscales=4;
> consistency=0;
> reflect=0;
> wavefile='bior1.1';
> N=8;
> load sumsin;
> s=sumsin;
> im1=imread('Sunset.jpg');
> im2=imread('Winter.jpg');
> if consistency==1
> wavelet.fusion=consistency;
> [c,l]= wavedec2(s,N,'bior1.1');
> subplot(2,3,5);
> imshow(c);
> else
> [c,l]= wavedec2(s,N,'bior1.1');
> subplot(2,3,5);
> imshow(c);
> end
> function w=wt2dscl(i, wavfile, reflect, nscales)
> wavfile='bior1.1';
> reflect=0;
> nscales=4;
> if consistency==1
> wavelet.fusion=consistency;
> [c,l]= wavedec2(s,N,'bior1.1');
> subplot(2,3,5);
> imshow(c);
> else
> [c,l]= wavedec2(s,N,'bior1.1');
> subplot(2,3,5);
> imshow(c);
> end
> [i]=M(im1,im2);
>
> function M=getCoMatrix(M1,M2)
> M = zeros(2); % 2x2 result matrix for binary image.
> [r,c] = size(M);
>
> for i=1:r
> for j=1:c
> v1 = M1(i,j) + 1 % Add one to binary image values to get Matlab indices.
> v2 = M2(i,j) + 1;
> M(v1,v2) = M(v1,v2) + 1; % Increment co-occurrence value.
> end
> end
> function i =wt2dsc2(w, wavfile, reflect, nscales)
> [C,S]=waverec2(w,'bior1.1',0,4);
>
> % --- Executes during object creation, after setting all properties.
> function popupmenu1_CreateFcn(hObject, eventdata, handles)
> % hObject handle to popupmenu1 (see GCBO)
> % eventdata reserved - to be defined in a future version of MATLAB
> % handles empty - handles not created until after all CreateFcns called
>
> % Hint: popupmenu controls usually have a white background on Windows.
> % See ISPC and COMPUTER.
> if ispc
> set(hObject,'BackgroundColor','white');
> else
> set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
> end
>
>
> % --- Executes on selection change in popupmenu1.
> function popupmenu1_Callback(hObject, eventdata, handles)
> % hObject handle to popupmenu1 (see GCBO)
> % eventdata reserved - to be defined in a future version of MATLAB
> % handles structure with handles and user data (see GUIDATA)
>
> % Hints: contents = get(hObject,'String') returns popupmenu1 contents as cell array
> % contents{get(hObject,'Value')} returns selected item from popupmenu1
>
>
> % --- Executes on button press in pushbutton6.
> function pushbutton6_Callback(hObject, eventdata, handles)
> % hObject handle to pushbutton6 (see GCBO)
> % eventdata reserved - to be defined in a future version of MATLAB
> % handles structure with handles and user data (see GUIDATA)
>
>
>
> % --- Executes on button press in pushbutton7.
> function pushbutton7_Callback(hObject, eventdata, handles)
> % hObject handle to pushbutton7 (see GCBO)
> % eventdata reserved - to be defined in a future version of MATLAB
> % handles structure with handles and user data (see GUIDATA)
>
>
>
> % --- Executes on button press in pushbutton8.
> function pushbutton8_Callback(hObject, eventdata, handles)
> % hObject handle to pushbutton8 (see GCBO)
> % eventdata reserved - to be defined in a future version of MATLAB
> % handles structure with handles and user data (see GUIDATA)
> imageE=imread('Winter.jpg');
>
> % --- Executes on button press in pushbutton9.
> function pushbutton9_Callback(hObject, eventdata, handles)
> % hObject handle to pushbutton9 (see GCBO)
> % eventdata reserved - to be defined in a future version of MATLAB
> % handles structure with handles and user data (see GUIDATA)
> imageE=imread('Winter.jpg');
> subplot(2,3,3);
> imageB=imshow(imageE);
>
>
> % --- Executes on button press in pushbutton10.
> function pushbutton10_Callback(hObject, eventdata, handles)
> % hObject handle to pushbutton10 (see GCBO)
> % eventdata reserved - to be defined in a future version of MATLAB
> % handles structure with handles and user data (see GUIDATA)

Hi, I'm not sure what you want the function wavelet.m to do. sumsin is a 1D signal. You obtain the wavelet coefficents for that 1D signal, which is a row vector. But then you attempt to visualize it with imshow(). Why do you try to display those coefficients as an image?

Wayne
 | 
Pages: 1
Prev: Solving PDE's using PDEDE
Next: Percent Format