help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

how to display an image having imaginary part


From: preethi k
Subject: how to display an image having imaginary part
Date: Wed, 5 Dec 2012 14:51:24 +0530

hi all,
        While doing the wiener filter in image processing imshow shows warning when displaying a image having imaginary part. I didn't get the result. How can we display a image having imaginary part. Following is my code.

%wiener
close all;
clear all;
clc;


a=imread('/home/preethi/diplab/Images/lenna.jpg');
x=double(a);
h=[0 .05 .05 0;.15 .1 .1 .15;.0 .1 .1 .0;0 .1 .1 0];
[m n]=size(x);
gmn=conv2(x,h);
[m1 n1]=size(gmn);
%without noise
hkl=fft2(h,m1,n1);
gkl=fft2(gmn);
x=gmn;
sigma2x=var(var(x));
hkkl=conj(hkl);
hkl2=hkl.*hkkl;
denom=hkl2;
g1kl=hkkl./denom;
fmn=ifft2(gkl.*g1kl);
figure, subplot(131),imshow(a),title('original image');
subplot(132),imshow(uint8(gmn)),title('degraded image');
subplot(133),imshow(abs(fmn)),title('restored image');
%with noise
gmn=imnoise(uint8(gmn),'gaussian');
hkl=fft2(h,m1,n1);
gkl=fft2(gmn);
x=gmn;
sigma2w=(var(var(x)));
er=sigma2x/sigma2w;
hkkl=conj(hkl);
hkl2=hkl.*hkkl;
denom=hkl2+er;
g1kl=hkkl./denom;
fmn=ifft2(gkl.*g1kl);
figure, subplot(131),imshow(a),title('original image');
subplot(132),imshow(uint8(gmn)),title('degraded image with noise');
subplot(133),imshow(fmn),title('restored image');


--Thanks
Preethi

reply via email to

[Prev in Thread] Current Thread [Next in Thread]