How to apply imfilter function in 3d

2 次查看(过去 30 天)
oh = [-1 9 -45 0 45 -9 1] / 60;
V_x = imfilter( V, oh, 'corr', 'replicate', 'same' );
V_y = imfilter( V, oh', 'corr', 'replicate', 'same' );
Now, for applying imfilter with respect to z direction, I made this:
function V_z = central_diff_wrt_z( V )
[nRow, nCol, nDep] = size(V);
idx = 2:nDep-1;
V_z = zeros( size(V) );
V_z(:,:,2:end-1) = ( V(:,:,idx+1) - V(:,:,idx-1) ) / 2;
V_z(:,:,1) = ( V(:,:,2) - V(:,:,1) ) / 2;
V_z(:,:,end) = ( V(:,:,end) - V(:,:,end-1) ) / 2;
end
However, I want to use imfilter in z-direction. How to use it?

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Statistics and Machine Learning Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by