www.pudn.com > Tikhonov_Regularization_for_super_resolution.rar > test.m, change:2010-07-06,size:1203b


% test for super resolution 
clear all; 
clc; 
load text; 
LR = double(text); 
addpath([pwd '\LKOFlow']);   %add LKOFlow folder to the current path 
 
D = fspecial('laplacian', 0.25);   % generate the Laplacian operator 
 
B = fspecial('gaussian', [3 3], 0.5);  % get point spread function 
 
S = 2; % sampling factor 
 
M=RegisterImageSeq(LR); % gaussian pyramid image registration 
M=round(M.*S); 
M=mod(M,S)+S; 
 
Mr=floor(M / S); 
[X,Y]=meshgrid(1:size(LR, 2), 1:size(LR, 1)); 
for i=1:size(LR, 3) 
    LR(:,:,i)=interp2(X+Mr(i,1), Y+Mr(i,2), LR(:,:,i), X, Y, '*spline'); 
end 
 
 
[X,Y]=meshgrid(0:S:(size(LR, 2)-1)*S, 0:S:(size(LR, 1)-1)*S); 
[XI,YI]=meshgrid(S-1:(size(LR,2))*S, S-1:(size(LR,1))*S); 
 
Zn=interp2(X, Y, LR(:,:,1), XI, YI, '*spline');   % get the initial value of high resolution using spline interpolation 
imshow(uint8(Zn));        % show the initial image 
 
p = size(LR, 3);         % compute the number of low resolution images 
arfa = 0.005;  % regularizaton parameter 
labud = 0.1 ;   % step size 
I = SuperRes(LR(2:end,2:end,:), Zn, S, M, B, D, p, arfa, labud);   % tikhonov regularization for super resolution  
figure, imshow(uint8(I))  % show the super resolution image