【发布时间】:2017-04-20 08:54:38
【问题描述】:
我正在尝试在 Matlab 中实现 3D 高斯滤波器 - 不使用内置的 Matlab 滤波函数,如 imfilter、imgaussfilt 等...
我有一个 3D 数据
RAW(K,K,K)
例如,K = 100,过滤宽度为delta = 5。
目前,我有:
Ggrid = -floor(delta/2):floor(delta/2);
[X Y Z] = meshgrid(Ggrid, Ggrid, Ggrid);
% Create Gaussian Mask
GaussM = exp(-(X.^2 + Y.^2 + Z.^2) / (2*delta^2));
% Normalize so that total area (sum of all weights) is 1
GaussM = GaussM/sum(GaussM(:));
这给了我一个尺寸为K+1 * K+1 * K+1 的 3D 高斯内核。
现在,为了得到过滤后的数据,我想做一个卷积:
FilteredData = conv(RAW,GaussM);
但存在尺寸不匹配。有人可以指出我哪里出错了吗?我假设我在高斯掩码 GaussM 中犯了一些错误。
【问题讨论】:
标签: image matlab 3d filtering gaussian