# 傅立葉轉換

``````>>> import numpy as np
>>> np.fft.fft(np.exp(2j * np.pi * np.arange(8) / 8))
array([ -3.44509285e-16 +1.14423775e-17j,
8.00000000e+00 -5.68502218e-15j,
2.33486982e-16 +1.22464680e-16j,
1.44328993e-15 +1.77635684e-15j,
9.95799250e-17 +2.33486982e-16j,
0.00000000e+00 +1.64244978e-15j,
1.14423775e-17 +1.22464680e-16j,  -1.44328993e-15 +1.77635684e-15j])
>>> import matplotlib.pyplot as plt
>>> t = np.arange(256)
>>> sp = np.fft.fft(np.sin(t))
>>> freq = np.fft.fftfreq(t.shape[-1])
>>> plt.plot(freq, sp.real, freq, sp.imag)
[<matplotlib.lines.Line2D object at 0x03BFCB50>, <matplotlib.lines.Line2D object at 0x03C06770>]
>>> plt.show()```
```

# 參考文獻

1. OpenCV-图像处理和计算机视觉 — http://hyry.dip.jp:8000/pydoc/opencv_intro.html
• 读写图像和视频文件
2. Introduction to Media Computation:A Multimedia Cookbook in Python, Mark Guzdial, December 16, 2002
3. Python Imaging Library Handbook
4. Python Image Tutorial
5. Python Imaging Library (PIL)
6. OpenCV + Python
7. ImageMagick
8. SciPy : ndimage

You also have an approach to image processing based on "standard" scientific modules: SciPy has a whole package dedicated to image processing: scipy.ndimage. Scipy is in effect the standard general numerical calculations package; it is based on the de facto standard array-manipulation module NumPy: images can also be manipulated as array of numbers. As for image display, Matplotlib (also part of the "science trilogy") makes displaying images quite simple.

Depending on what you mean by "image processing", a better choice might be in the numpy based libraries: mahotas, scikits.image, or scipy.ndimage. All of these work based on numpy arrays, so you can mix and match functions from one library and another.