我读过关于频域高斯滤波器的文章,但有些地方我无法理解:
fft2将图像从空域转换到频域,然后用ffshift对图像进行集中处理。我想要的是将图像的频域矩阵乘以高斯滤波矩阵,然后利用ifft2将结果转化为空间域,但由于图像的高斯滤波矩阵和频域矩阵的大小不同,它们不能相乘。(这里我不使用conv2和fspectial )。发布于 2013-03-16 17:30:54
Guassian滤波器实际上是圆形的,因为它是距离中心的距离的函数。使用矩形矩阵是因为它更方便。
要克服大小差异,您可以做的是对过滤器进行零填充:
img = imread( imgFileName ); % read image, use gray-level images here.
IMG = fft2( img ); % Fourier of img
sz = size( img );
h = fspecial( 'gaussian', sz, sigma ); % create a filter with std sigma same size as img
H = fft2( h ); % Fourier of filter
F = IMG.*H; % filter in Fourier space
f = ifft2( F ); % back to spatial domain. https://stackoverflow.com/questions/13765580
复制相似问题