更新时间:2021-11-14 00:11:06
这里有另一种选择:
创建2D高斯:
function f=gaussian2d(N,sigma)
% N is grid size, sigma speaks for itself
[x y]=meshgrid(round(-N/2):round(N/2), round(-N/2):round(N/2));
f=exp(-x.^2/(2*sigma^2)-y.^2/(2*sigma^2));
f=f./sum(f(:));
已过滤的图片,给定您的图片称为 Im
:
Filtered image, given your image is called Im
:
filtered_signal=conv2(Im,gaussian2d(N,sig),'same');
以下是一些情节:
imagesc(gaussian2d(7,2.5))
Im=rand(100);subplot(1,2,1);imagesc(Im)
subplot(1,2,2);imagesc(conv2(Im,gaussian2d(7,2.5),'same'));