图像处理与傅里叶变换

Posted Matrix_11

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了图像处理与傅里叶变换相关的知识,希望对你有一定的参考价值。

图像处理与傅里叶变换

一维傅里叶变换

  • 连续域

F ( w ) = ∫ − ∞ ∞ f ( x ) e − j 2 π w x d x F(w) = \\int_{-\\infty}^{\\infty} f(x) e^{-j2\\pi wx} dx F(w)=f(x)ej2πwxdx

f ( x ) = ∫ − ∞ ∞ F ( w ) e j 2 π w x d w f(x) = \\int_{-\\infty}^{\\infty} F(w)e^{j2\\pi wx}dw f(x)=F(w)ej2πwxdw

  • 离散域

F ( k ) = 1 N ∑ x = 0 N − 1 f ( x ) e − j 2 π k x / N , k = 0 , 1 , 2 , . . . N − 1 F(k) = \\frac{1}{N}\\sum_{x=0}^{N-1}f(x)e^{-j2\\pi kx/N}, \\quad k=0,1,2,...N-1 F(k)=N1x=0N1f(x)ej2πkx/N,k=0,1,2,...N1

f ( x ) = ∑ k = 0 N − 1 F ( k ) e j 2 π k x / N , x = 0 , 1 , 2 , . . . N − 1 f(x) = \\sum_{k=0}^{N-1}F(k)e^{j2\\pi kx/N}, \\quad x=0,1,2,...N-1 f(x)=k=0N1F(k)ej2πkx/N,x=0,1,2,...N1

二维傅里叶变换

  • 连续域

F ( u , v ) = ∫ − ∞ ∞ ∫ − ∞ ∞ f ( x , y ) e − 2 j π ( x u + y v ) d x d y F(u, v) = \\int_{-\\infty}^{\\infty} \\int_{-\\infty}^{\\infty} f(x, y) e^{-2j \\pi (xu + yv)} dxdy F(u,v)=f(x,y)e2jπ(xu+yv)dxdy

f ( x , y ) = ∫ − ∞ ∞ ∫ − ∞ ∞ F ( u , v ) e 2 j π ( x u + y v ) d u d v f(x, y) = \\int_{-\\infty}^{\\infty} \\int_{-\\infty}^{\\infty} F(u, v) e^{2j \\pi (xu + yv)} dudv f(x,y)=F(u,v)e2jπ(xu+yv)dudv

  • 离散域

F ( u , v ) = 1 M N ∑ x = 0 N − 1 ∑ y = 0 M − 1 f ( x , y ) e − 2 j π [ x u N + y v M ] F(u, v) = \\frac{1}{MN}\\sum_{x=0}^{N-1} \\sum_{y=0}^{M-1}f(x, y) e^{-2j \\pi [\\frac{xu}{N} + \\frac{yv}{M}] } F(u,v)=MN1x=0N1y=0M1f(x,y)e2jπ[Nxu+Myv]

f ( x , y ) = ∑ x = 0 N − 1 ∑ y = 0 M − 1 F ( u , v ) e 2 j π [ x u N + y v M ] f(x, y) = \\sum_{x=0}^{N-1}\\sum_{y=0}^{M-1} F(u, v) e^{2j \\pi [\\frac{xu}{N} + \\frac{yv}{M}] } f(x,y)=x=0N1y=0M1F(u,v)e2jπ[Nxu+Myv]

x = 0 , 1 , 2 , . . . N − 1 , y = 0 , 1 , 2 , . . . M − 1 u = 0 , 1 , 2 , . . . N − 1 , v = 0 , 1 , 2 , . . . M − 1 x = 0, 1, 2, ... N-1, \\quad y = 0, 1, 2,... M-1 \\\\ u = 0, 1, 2, ... N-1, \\quad v = 0, 1, 2,... M-1 x=0,1,2,...N1,y=0,1,2,...M1u=0,1,2,...N1,v=0,1,2,...M1

# -*- coding: utf-8 -*-
"""
Created on Sun Oct 10 16:05:40 2021
@author: shiyi
"""

import numpy as np
import matplotlib.pyplot as plt

PI = np.pi
N = 256

x = np.linspace(0, 1, N)
y = np.linspace(0, 1, N)
X,Y = np.meshgrid(x, y) 

wx = 10 * PI
wy = 0 * PI
Z = np.sin(wx * X + wy * Y)
fft_ = np.fft.fft2(Z)
fshift_ = np.fft.fftshift(fft_) 
mag_fft = (np.abs(fshift_))
plt.figure(figsize=(10, 8))
plt.subplot(3, 2, 1)
plt.imshow(Z, cmap='gray')
plt.xlabel('wx=10PI, yx=0')
plt.title('Z = sin(wx * X + wy * Y)')
plt.subplot(3, 2, 2)
plt.imshow(mag_fft, cmap='gray')
plt.title('FT of Z')


wx = 0 * PI
wy = 10 * PI
Z = np.sin(wx * X + wy * Y)
fft_ = np.fft.fft2(Z)
fshift_ = np.fft.fftshift(fft_) 
mag_fft = (np.abs(fshift_))
plt.subplot(3, 2, 3)
plt.imshow(Z, cmap='gray')
plt.xlabel('wx=0, yx=10PI')
# plt.title('Z = sin(wx * X + wy * Y)')
plt.subplot(3, 2, 4)
plt.imshow(mag_fft, cmap='gray')
# plt.title('FT of Z')

wx = 10 * PI
wy = 10 * PI
Z = np.sin(

以上是关于图像处理与傅里叶变换的主要内容,如果未能解决你的问题,请参考以下文章

图像处理与傅里叶变换

数字图像处理 - 频率域处理关于傅里叶级数与傅里叶变换

opencv-python图像处理 ---直方图与傅里叶变换逆变换

3. OpenCV-Python——图像梯度算法边缘检测图像金字塔与轮廓检测直方图与傅里叶变换

3. OpenCV-Python——图像梯度算法边缘检测图像金字塔与轮廓检测直方图与傅里叶变换

学习小波变换与傅里叶变换