Hi,
I have two stock tiff images called elaine and lena. Both are 8-bit 512x512. I am trying to show that phase caries more info than the amplitude by following Jim Fienup's slideshow from here: http://www.eecs.umich.edu/systems/FienupSeminar.pdf The code is relatively simple:
(* reading the two images in *)
elaineTiff = Import["elaine.tiff"];
elaine = ImageData[ColorNegate[elaineTiff]];
lenaTiff = Import["Lena.tiff"];
lena = ImageData[ColorNegate[lenaTiff ]];
(* Fourier tranform them and calculate amplitude and phase *)
elaineFt = FourierDCT[elaine];
lenaFt = FourierDCT[lena];
elaineFtAbs = Abs[elaineFt];
lenaFtAbs = Abs[lenaFt];
elaineFtPhase = Table[ArcTan[Im[elaineFt[[i, j]] ]/Re[elaineFt[[i, j]] ] ], {i, 1, Length[elaineFt]}, {j, 1, Length[elaineFt[[i]] ]}];
lenaFtPhase = Table[ArcTan[Im[lenaFt[[i, j]] ]/Re[lenaFt[[i, j]] ] ], {i, 1, Length[lenaFt]}, {j, 1, Length[lenaFt[[i]] ]}];
(* then matching elaine amplitude to lena phase and vica verse and
matching elaine amplitude to elaine phase and lena amplitude to lena phase *)
elaineFtAbslenaFtPhase = elaineFtAbs*Exp[I*lenaFtPhase ];
lenaFtAbselaineFtPhase = lenaFtAbs*Exp[I*elaineFtPhase ];
elaineFtAbselaineFtPhase = elaineFtAbs*Exp[I*elaineFtPhase ];
lenaFtAbslenaFtPhase = lenaFtAbs*Exp[I*lenaFtPhase ];
(* then using Fourier transform again to convert them back to image space *)
elainelena = FourierDCT[elaineFtAbslenaFtPhase];
lenaelaine = FourierDCT[lenaFtAbselaineFtPhase];
elaineelaine = FourierDCT[elaineFtAbselaineFtPhase];
lenalena = FourierDCT[lenaFtAbslenaFtPhase];
(* finally taking the Abs values and display them by Image *)
{Image[Abs[elainelena] ], Image[Abs[lenaelaine]]}
{Image[Abs[elaineelaine] ], Image[Abs[lenalena] ]}
I expected to see the original images on the last line, but I did not get that. What am I doing wrong?
Attachments: