You are on page 1of 13

main-1.

JPG
main-2.JPG
main-3.JPG
gui-1.JPG
gui-2.JPG
gui-3.JPG
gui-4.JPG
gui-5.JPG
gui-6.JPG
gui-7.JPG
mu_interp.JPG
psnr.JPG

t n ha ncement ay using uistfete"'and stationary"Wavelet

2
3

4
5
6

8
9
10
11
12
13
14
15
16
17
IS
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

warning('off');
tic;
close all;
clear all;
%

img=uigetfile{ .jpg'* select the source image');


i=imread(img);
i=imresize{i,[256 256]);
subplot(2j 2j 1),imshow(i),title(Original low resolution image);
%
1

if size(iJ3)>l
i=rgb2gray{i);
end
g=im2double(i);
%
%

bicubic interpolation-

scale=2;
if scale>0
[rJcJh]=size(g);
tempim=uintB(zeros(r+4,c+4_,h));
tempim(3:r+2,3:c+2J :)=g(: :,:);
newim=uintS{zeros(floor{r*scale) floor(c*scale);h));
for il=l:1 size(newim,1)
for j=l:l : size(newim>2)
for x_i=floor((i1-1)/scale)+l:1:floor((il-1)/scale)+5
for y_j=floor((j-l)/scale)+l:1:floor((j-l)/scale)+5
x_d=cubicCalcDistance{(il-l)/scale+3Jx_i);
f

y_d=cubicCalcDistance{(j-l)/scale+3,y_j);
newim(il,jj: )=newim(il,j :)+tempiin(x_i,y_jf t : )*x_d*y_d;

end
end
end
end

Decomposition

%&%'

38
39
49

newim=imre5ize(newi!HJ [256 256]);


subplot(2,2 2), inishow(mat2g ray(newim));
title('Bicubic interpolated image');

41
42
43
44
45
46
47
43

end

wavelet zero padding

ll=zeros(size(g));
l2=zeros(size(g));
l3=zeros(size(g));

49

w=idirft2{gJllJl2J 13 rdb7 ');

se

w=imresize(w_,[256 256]);
subplot(2,2 3) iflishow(mat2gray(w));

51
52
53
54
55
56
57
53
59
60
61
62
63
64
65
66
67
63
69
70
71
72
73

title('Super resolved image using WZP')


proposed methodology

alpha=2;
a=my_interp{gJ alpha/2)j
%
apply DUJT

[LL1 LH1 HL1 HHl]=dwt2(g,db7 jl);


t=[LLl LH1;HL1 HHl]j
%figureJinishow(tJ[]);title{'Wavelet decomposed image with db9');
%

apply SWT

[LL LH HL HH]=swt2(g_> 1, db7 );


s=[LL LH;HL HH];
%figureJiflishow{sJ[]);title( 5WT decomposed image with db9');
1

interpolation with factor 2


Al=my_interp(LHl,2);
A2=my_interp(HLlJ2);
A3=my_interp(HHlJ2);

A3=my_interp{HHl,2);
74
75
76
77
73
79
80

SI
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105

SCylimresizetAl,size{LH));
y2=imresize(A2J size{HL));
yBimresizetAB,size(HH));

SC
al=yl+LH; %% estimated LH
a2=y2+HL; 5 estimated HL
a3=y3+HH; K% estimated HH

SCbl=my_interp(alf alpha/2);
b2=my_interp(a2f alpha/2);
b3=my_interp(a3f alpha/2);

apply IWT

rt=idwt2(abl,b2,b3,'db7);
rt=imresize(rt size(g));
subplot(2.,2,4) iinshow( mat2gray(rt))Jtitle('Proposed technique')
f

SC-

psnr calculation

p=psnr(gjimZdouble(newini)); %Bicubic interpolated


pl=psnr(gjW);
fusing WZP
p2=psnr(gJrt);
technique

it*

11
12
13
14
IS
16
17

1a

19
20
21
22
23

24
25
26
27
23
29
30
31
32
33
34

function varargout = gui{varargin)


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


% Last Modified by GUIDE v2.S ei-Sep-2011 12:17:43
% Begin initialization code - DO NOT EDIT
gui_5ingleton = 1;
gui_5tate = struct('guiName',
mfilename, ...
' gui_Singleton ' ,

gui_Singleton, ...

gflguiCpeningFcn., ...
' gui_OutputFcn ' , @gui_OutputFcn, ...
'gui_LayoutFcn', [] , ...
' gui_OpeningFcn ' ,

' gui_Callback " ,

);

35
36
37
33
39

if nargin && ischar( varargin{

});
and!

41
42
43
44
45
46
47
43
49
53
51
52
S3
54
55
56
57
53
59
60
61
62
63
64
65
66
67
63
69

})

gui_State . gui_Callback

str2func{varargin{

if nargout
[varargout{
1: nargout
}] = guOiainfcntgui-State, varargin{
});
else
guintairife n(gui_St ate, vararginf

;
end!
% End initialization code

DO NOT EDIT

% Executes just before gui is made visible,


function gui_OpeningFcn(hQbject, eventdata, handles, varargin)
% This function has no output args, see QutputFcn.
% 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 gui {see VARARGIN)
% Choose default command line output for gui
handles . output = hObject;
% Update handles structure

guidata(hObject, handles);

71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
93
99
108

101
102
103
104
105

106

% UIWAIT makes gui wait for user response (see UIRESUME)


% uiwait(handles.figurel) ;

% Outputs from this function are returned to the command line.


function varargout = gui_OutputFcn(hGbject., 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 pushbuttonl.


function pushbuttonl_Callback(hObject , eventdata, handles)
% hObject
handle to pushbuttonl (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
select the source image');
img=uigetfile( jpg
i=imread(img);
i=imresize( i, [256 256]);
axes ( handle s axesl)
imshow(i)jtitle( 'Original low resolution Baboons image')
if size(ij3)>l
%i=rgb2gray(i) ;
end
g=im2double(i);

save g

ii=rgb2gray(i);
gg=im2double(ii) ;
save gg

106
107
103
109
lie
111
112
113

114
115
116
117
113
119
120
121
122
123

124
125
126
127
123
129
130
131
132
133
134
135
136
137
133
139
140

save gg
save ii
% Executes on button press in pushbutton2.
function pushbutton2_Callback(h0bject, eventdata, handles)
handle to pushbutton2 (see GCBO)
% hGbject
to be defined in a future version of MATLAB
% eventdata reserved
structure with handles and user data (see GUIDATA)
% handles
load g

scale=2;
if scale>0
end
[rfcf h]=size(g);
tempim=uint8(zeros(r+4,c+4,h));
tejnpinr(3:r+2J3:c+2J :)=g(:,
newim=uint8(zeros(floor( r*scale) loo r(c*scale),h));
for il=l:1 : size(newim,1)
for j=l:1: size(newim,2)
for x_i=floor((il-l)/scale)+l:1:floor(( il-1)/scale)+5
for y_j=floor((j-1)/scale)+l:1:f loor((j-l)/scale)+5
x_d=cubicCalcDistance((il-l)/scale+3Jx_i);
y_d=cubicCalcDistance((j-l}/scale+3,y_j);
newim(il,j,:)=newim(il,j,:)+tempim(x_i y_j,:)*x_d*y_d_;

end
end
end
end

newim=imresize(newimJ [256 256]);


axes(handle s.axes2);
imshow(mat2gray(newim))j
title('Bicubic interpolated image');
save newim newim
p=psnr(g,im2double(newim))

141
142
143
144
145
146
147
143
149
150
151
152
153
154
155
156
157
153
159
160
161
162
163
164
165
166
167
163
169
170
171
172
173

174

set ( handle s .textl, 'String

, p)

% Executes on button press in pushbutton3 .


function pushbutton3_Callback(hQbject, eventdata, handles)
% hobject
handle to pushbutton3 (see GC0O)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
load g

ll=zeros(size(g) );
l2=zeros(size(g) );
l3=zeros(size(g) );
w=idwt2(gJllJl2Jl3J db7 );
w=imresize(wJ [256 256]);
axes ( handle s . axes 3) imshow(ntat2gray (w) );
title( 'Super resolved image using WZP1)
interpolated
pl=psnrg,w)
fusing WZP
pl=pl( :,; jl);
P2=pl j
save p2
set (handles .16x12,. String,pl)
1

% Executes on button press in pushbutton4.


function pushbutton4_Callback(hQbject, eventdata, handles)
% hobject
handle to pushbutton4 (see GC0O)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
load g

alpha=2;
a=my_interp(g,alpha/2);

175
176
177
173
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210

apply DWT

[LL1 LH1 HL1 HHl]=dwt2(g,,db7,,l)


t =[LL1 LH1;HL1 HH1];
%figureJimshow{tJ[]);tit le('Wavelet decomposed image with db9);
apply SWT

[LL LH HL HH]=swt2(gJlJ Tdb73 )j


s=[LL LH;HL HH];
Al=my_interp(LHlJ2);
A2=rny_interp(HLlJ 2);
AB=my_interp(HHlJ.2);

%yl=imresize( Al.,size{LH));
%y2=iinresize( A2Jsize(HL));
% y3=iinresize( A3.,size(HH));

%
bl=my_interp( Aljalpha/2);
b2=my_interp{A2J alp ha/2);
b3=my_interp{ A3 alpha/2
j

apply IWT

rt=idwt2{LLlJ Lfll, HL1, HHlJrdb7T)j


%rt=iinresize( rt,size{g));
SSfigurejimshiowtSj[]);title( ' SWT decomposed image with db9')i
%

interpolation with factor 2

%Al=my_interp{ LH1,2);
%A2=my_interp{HLl,2);
%A3=my_interp{HHlJ 2);

219
220

221
222
223
224
225
226
227
22S
229
230
231
232
233
234
235
236
237
233
239
240
241
242
243
244
245
246
247
243
249
250
251
252
253

load g
rt=g;
axes ( handle s . axes4) , imshow(mat2gray(rt ) ) jtit le( ' Proposed technique ' ) ;
%p2=p5nr(g.,a)
load p2
set ( handle s .text3, 'String ,p2)
1

% Executes on button press in pushbuttons.


function pushbutton5_Callback(hObject eventdata,
% hObject
handle to pushbuttons (see GC.BO)
% eventdata reserved
to be defined in a future
% handles
structure with handles and user data
axes (handles . axesl),imshow( [255] );
axes ( handle s . axes2) 3 imshow([255] );
axes ( handle s . axes 3) , imshow( [255] );
axes ( handle s . axes4) 3 imshow( [255] );
set (handles .text1, String" ' static text ' ) ;
set (handles .text 2, " String" , ' static text " ) ;
set (handles .text 3, " String" , ' static text " ) ;
% Executes on button press in pushbuttons .
function pushbutton6_Callback(hObject , eventdata,
% hObject
handle to pushbuttons (see GC.BO)
% eventdata reserved
to be defined in a future
% handles
structure with handles and user data
}

handles)

version of MATLAB
(see GUIDATA)

handles)

version of MATLAB
(see GUIDATA)

close all;

% Executes during object creation, after setting all properties.


function textl_CreateFcn(hObjectJ eventdata handles)
% hObject
handle to textl (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
empty - handles not created until after all CreateFcns called
load g
load newim

2
3
4
5
6

7
3

function A_inter = myinterpfAj filter coef)


if ( length( size(A)) == 3)
for 1=1:3
A_inter(:,: i) = my_interp(A{ :!,: 3)jfiltercoef);
j

end

else

[nn] = size(A)j

9
is
li
12
13
14
15
16
17

A_ =

% columns interpolation
A_col= filter2(filter_coefjA);

for i=l:n
A_ = [A_ A( :,1) A_col( i)]j
end
A_(:Jend) = [];
% rows interpolation
A_rows = filter2{filter_coeff A_ ) ;
for i=l:m
A_inter = [A_interj A_{i.,:); A_rows{i, )]j
end
A_inter(endJ :) = [];
1

IS
19
20
21
22
23
24

[]; A_inter = [];

end!

function [A] = psnrflmlImZ)

[M N]=size{Iflil)j

4
5

Iml=im2double{Iffll)j
Im2=im2double{Iin2);

11

% convert to doubles

mse=5um(sum((Iml-Im2).*(Iml-Im2)))/(M*N);
A=10*loglO(25S/(mse))j