# Image Reconstruction:Phase vs. Magnitude

Figure 1.(c) shows the Test image reconstructed from MAGNITUDE spectrum only. We can say that the intensity values of LOW frequency pixels are comparatively more than HIGH frequency pixels.

Figure 1.(d) shows the Test image reconstructed from PHASE spectrum only. We can say that intensity values of HIGH frequency (edges,lines) pixels are comparatively more than LOW frequency pixels.

Why this magical contradiction of intensity change (or exchange) is present between Test image reconstructed from MAGNITUDE spectrum only and Test image reconstructed from PHASE spectrum only, which when combined together form the original Test image?

clc;
clear all;
close all;
i1=rgb2gray(i1);

f1=fftn(i1);
mag1=abs(f1);
s=log(1+fftshift(f1));
phase1=angle(f1);

r1=ifftshift(ifftn(mag1));
r2=ifftn(exp(1i*phase1));
figure,imshow(i1);
figure,imshow(s,[]);
figure,imshow(uint8(r1));
figure,imshow(r2,[]);
r2=histeq(r2);
r3=histeq(uint8(r2));
figure,imshow(r2);
figure,imshow(r3);


Figure 1.(c) shows the Test image reconstructed from MAGNITUDE spectrum only. We can say that the intensity values of LOW frequency pixels are comparatively more than HIGH frequency pixels.

Actually, this is not correct. The phase values determine the shift in the sinusoid components of the image. With zero phase, all the sinusoids are centred at the same location and you get a symmetric image whose structure has no real correlation with the original image at all. Being centred at the same location means that the sinusoids are a maximum at that location, and is why there is a big white patch in the middle of Figure 1.c.

The phase-only reconstruction preserve features because of the principle of phase congruency. At the location of edges and lines, most of the sinusoid components have the same phase. See http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/OWENS/LECT7/node2.html This properly alone can be used to detect lines and edges, http://www.csse.uwa.edu.au/~pk/research/pkpapers/phasecorners.pdf , without regard to magnitude. So you can see that the phase information is most important.

Changing the magnitude of the various component sinusoids changes the shape of the feature. When you do a phase-only reconstruction, you set all the magnitudes to one, which changes the shape of the features, but not their location. In many images the low frequency components have a magnitude higher than the high frequency components, so phase-only reconstruction does look like a high-pass filter.

In short, phase contains the information about the locations of features.

You cannot add the phase-only and magnitude-only images to get the original. You can multiply them in the Fourier domain and transform back to get the original.

• @geometrical thank u sir for explanation.I read article but i have a doubt.sir,you said "At the location of edges and lines, most of the sinusoid components have the same phase." and using phase congruency method these can be detected .but sir low frequency components from white big patch also can have same phase ? so these frequencies also should be detected. also i have prepared one code as u said in your last line of answer,but i am unable to reconstruct the original image... i am adding my code in next comment. – sagar Jun 24 '14 at 6:10
• @geometrical 'clc; clear all; close all; i1=imread('C:\Users\Admin\Desktop\rough\Capture1.png'); i1=rgb2gray(i1); figure,imshow(i1); f1=fftn(i1); mag1=abs(f1); phase1=angle(f1); a1=fftn(mag1); a2=fftn(phase1); a3=a1.*a2; a4=ifftn(a3); figure,imshow(uint8(a4));' – sagar Jun 24 '14 at 6:15
• In the big white patch image all the sinusoids have been shifted to have the same phase (= 0) in the centre. Phase congruency is about detecting line or edge features in images. It is another proof that phase is most important for image structure. With your code I mean reconstruct with the phase and magnitude images. – geometrikal Jun 24 '14 at 7:37
• clc; clear all; close all; i1=imread('peppers.tif'); i1=rgb2gray(i1); figure,imshow(i1); f1=fftn(i1); mag1=abs(f1); phase1=exp(1i * angle(f1)); a1=ifftn(mag1); a2=ifftn(phase1); a3=fftn(a1).*fftn(a2); a4=ifftn(a3); figure,imshow(uint8(a4)); – geometrikal Jun 24 '14 at 7:38
• sir sorry to disturb you but what happens to the low frequency components which have same phase.they also should be preserved in phase only reconstruction.?? – sagar Jun 24 '14 at 13:07

In your line mag1=abs(f1); you are leaving the total intensity of the image unchanged (test this by summing up the intensities over all pixels). Rejecting the phase information in Fourier space just leads to a spatial redistribution of the intensity in real space, such that r1 will have the same total insity as i1.

In your line phase1=angle(f1); you are normalizing the amplitudes of each pixel (in Fourier space) to 1, so the total intensity of the image will be changed. As the phase carries a large part of the spatial information of the image, major features of the image are nevertheless preserved.