find the error in the code.
Show older comments
code: % input is a gray image y=imread('c:\working\lena.jpg');
%x=rgb2gray(y); [Lo_D,Hi_D,Lo_R,Hi_R] = wfilters('haar'); [LL,LH,HL,HH]=dwt2(y,Lo_D,Hi_D);
figure(1),imshow(uint8(LL));title(' LL Image'); figure(2),imshow(y);title('INput Image');
dec=[... LL,LH HL,HH ... ]; LLI = imresize(LL,2,'bicubic'); LHI = imresize(LH,2,'bicubic'); HLI = imresize(HL,2,'bicubic'); HHI = imresize(HH,2,'bicubic'); image=double(y);
figure(3),imagesc(image); colormap gray;title('doubled input image');
figure(4),imagesc(LLI); colormap gray;title('iterpolated LL Image');
figure(5),imagesc(LHI); colormap gray;title('iterpolated LH Image');
figure(6),imagesc(HLI); colormap gray;title('iterpolated HL Image');
figure(7),imagesc(HHI); colormap gray;title('iterpolated HH Image');
Diff_Img=imsubtract(image,LLI);
figure(8),imagesc(Diff_Img);colormap gray;title('Difference Image');
[m,n]=size(Diff_Img);
for i=1:m
for j=1:n
ELH(i,j)=(Diff_Img(i,j)+LHI(i,j))/2;
end
end
figure(9),imagesc(ELH);colormap gray;title('Added LH Image');
for i=1:m
for j=1:n
EHL(i,j)=(Diff_Img(i,j)+HLI(i,j))/2;
end
end
figure(10),imagesc(EHL);colormap gray;title('Added HL Image');
for i=1:m
for j=1:n
EHH(i,j)=(Diff_Img(i,j)+HHI(i,j))/2;
end
end
figure(11),imagesc(EHH);colormap gray;title('Added HH Image');
%scale the image by factor of two
scale=2;
LLI2 = imresize(image,scale/2,'bicubic');
figure(12),imagesc(LLI2);colormap gray;title('Resized for IDWT input image');
LHI2 = imresize(ELH,scale/2,'bicubic');
figure(13),imagesc(LHI2);colormap gray;title('Resized LH Image');
HLI2 = imresize(EHL,scale/2,'bicubic');
figure(14),imagesc(HLI2);colormap gray;title('Resized HL Image');
HHI2 = imresize(EHH,scale/2,'bicubic');
figure(15),imagesc(HHI2);colormap gray;title('Resized HH Image');
% image=im2double(image);
out=idwt2(LLI2,LHI2,HLI2,HHI2,'haar');
figure(16),imagesc(out); colormap gray;title('output enhanced image');
%imshow(unit8(out));
Accepted Answer
More Answers (0)
Categories
Find more on Images in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!