help-octave
[Top][All Lists]
Advanced

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

Re: how to display an image having imaginary part


From: Andy Buckle
Subject: Re: how to display an image having imaginary part
Date: Wed, 5 Dec 2012 09:35:05 +0000




On 5 December 2012 09:21, preethi k <address@hidden> wrote:
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


You need to decide what the significance to you of the imaginary part is.

imshow(real(a))
imshow(abs(a))

might be meaningful. doing something fancy with colours might be meaningful to you. Perhaps real is blue and imaginary is green.

--
/* andy buckle */

reply via email to

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