1
$\begingroup$

I'm trying to implement a simple Image super resolution algorithm (DWT-Based Resolution Enhancement ) in the following paper

http://www.ripublication.com/aeee/52_pp%20%20%20405-412.pdf

I tried to implement the algorithm in figure 3 of this paper using Matlab.Code is given below.

img1 = imread('lena1.jpg'); %original High resolution image
[height, width, dim] = size(img1);

%%Downsampling the image by averaging
avgfilter = fspecial('average', [2 2]);
avgimg = filter2(avgfilter, img1);
img = avgimg(1:2:end,1:2:end); %Input low resolution image

[LL,LH,HL,HH] = dwt2(img,'haar'); %Decomposing

%Bicubic interpolation by factor 2 on each subbands
LL1 = imresize(LL,2,'bicubic');
LH1 = imresize(LH,2,'bicubic');
HL1 = imresize(HL,2,'bicubic');
HH1 = imresize(HH,2,'bicubic');

%% Calculating Difference image
for i=1:256
    for j=1:256
        img3(i,j,:) = img(i,j,:) - LL1(i,j,:);
    end
end


for i=1:256
    for j=1:256
        LH13(i,j,:) = img3(i,j,:) + LH1(i,j,:);
        HL13(i,j,:) = img3(i,j,:) + HL1(i,j,:);
        HH13(i,j,:) = img3(i,j,:) + HH1(i,j,:);
    end
 end

%bicubic interpolation(Here alpha = 2;Hence alpha/2 = 1) 
 img31 = imresize(img3,1,'bicubic');
 LH131 = imresize(LH13,1,'bicubic');
 HL131 = imresize(HL13,1,'bicubic');
 HH131 = imresize(HH13,1,'bicubic');

img4 = idwt2(img31,LH131,HL131,HH131,'haar'); %IDWT
t = uint8(img4)
imshow(t);
imsave;

Input image that I used is given below

enter image description here

But I'm getting a completely unexpected output as follows.

enter image description here Why this is happening.Please help.Thanks in advance.

$\endgroup$
6
  • 1
    $\begingroup$ Have you tried to debug your code, looking at intermediate results and checking if they are sensible? $\endgroup$ – Jazzmaniac Nov 6 '14 at 13:02
  • $\begingroup$ @Jazzmaniac Yes sir.I dont think that there is any mistake with the concept.May be due to some coding error.But couldn't find it out. $\endgroup$ – Celine Nov 7 '14 at 8:37
  • $\begingroup$ What you are displaying seems to be the gradient along both x and y $\endgroup$ – A.Rashad Oct 14 '15 at 6:22
  • $\begingroup$ I am also suffering from same problem.. I think there is problem in difference of spatial domain and frequency domain signals.. $\endgroup$ – user19982 Mar 11 '16 at 4:56
  • $\begingroup$ This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question once you have enough reputation. - From Review $\endgroup$ – Laurent Duval Mar 11 '16 at 6:46

Browse other questions tagged or ask your own question.