- #1
Joshuarr
- 23
- 1
Homework Statement
I'm working on a Matlab problem for a digital image processing class. The problem is to take an image, then take its 2D-FFT and offset the phase component by pi. Then to take the IFFT of the new DFT using the unmodified magnitude and modified phase.
What I got was a matrix of all zeros! -- A black image.
I'm not sure if this is the correct result, so I'm here. I notice that when I slowly change the phase offset towards +Pi it fades out.
This is a specific problem, but what I really want to know is: In general, how does a phase offset of pi radians to the DFT phase component affect the original image?
Homework Equations
The Attempt at a Solution
superman is an image we were given for this assignment
Matlab Code:
superman = imread('superman.png')
supermanDFT = fft2(superman);
supPhase = wrapTo2Pi(angle(supermanDFT) +pi);
supMag = abs(supermanDFT);
newSupermanDFT = supMag.*exp(1i*supPhase);
newSuperman = ifft2(newSupermanDFT);
newSuperman = real(newSuperman);
imshow(uint8(newSuperman))
I checked the code by using no phase offset --basically decomposing the image into phase and magnitude reconstructing the DFT with newSupermanDFT = supMag.*exp(1i*supPhase); and taking the inverse and looking at the image. I got the original image as expected. This doesn't guarantee the code is correct, but I have no reason to think its wrong. I'm not really sure what the result should be. :(
Thanks for any help.