> > The mathcad image processing module is too expensive for my taste.
> My university has a campus- wide license for Matlab, so it's *free* for me...
> I have no idea of what it would cost to purchase.
[reminder: never compare "educational licensing" with giving drugs to
schoolchildren.]
For something similar to matlab it might be worth investigating
python+matplotlib, which are free for everyone
(http://www.scipy.org/NumPyProConPage). The script below does a
phase/amplitude swap using an fft that came with the old Numeric
package, nowadays it might have a different name and hiding place.
Best,
Jon
---
from matplotlib.pylab import *
import FFT
# test data:
i = reshape(array(range(256)*256) , (256,256) )
j = transpose(i)
circle = where( (i-128)*(i-128) + (j-128)*(j-128) < 3000 , 10. , 0)
square = where( abs(i-128) + abs(j-128) < sqrt(2500) , 10. , 0)
# transform
image1 = circle
image2 = square
ft1 = FFT.fft2d(image1)
ft2 = FFT.fft2d(image2)
phi1=arctan2(ft1.real , ft1.imag)
phi2=arctan2(ft2.real , ft2.imag)
amp1phi2 = FFT.inverse_fft2d(abs(ft1)*sin(phi2) + abs(ft1)*cos(phi2)*1j)
amp2phi1 = FFT.inverse_fft2d(abs(ft2)*sin(phi1) + abs(ft2)*cos(phi1)*1j)
# plots:
subplot(221);title("image1");imshow(image1)
subplot(222);title("image2");imshow(image2)
subplot(223);title("amp1 phi2");imshow(amp1phi2)
subplot(224);title("amp2 phi1");imshow(amp2phi1)
show()
|