I am trying to implement a 3D Gaussian Filter in Matlab - WITHOUT using inbuilt Matlab filtering functions like imfilter, imgaussfilt etc...
I have a 3D data
RAW(K,K,K)
Say, K = 100
, and filter width delta = 5
for this example.
Currently, I have :
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(:));
Which gives me a 3D Gaussian Kernel of dimensions K+1 * K+1 * K+1
.
Now, to get the filtered data, I want to do a convolution like :
FilteredData = conv(RAW,GaussM);
but there is a dimensional mismatch. Can someone point out where I am going wrong? I assume I am making some mistake in the Gaussian mask GaussM
.