www.gusucode.com > images 案例代码 matlab源码程序 > images/Compute3DGradientMagnitudeAndDirectionUsingSobelMethodExample.m
%% Compute 3-D Gradient Magnitude and Direction Using Sobel Method % %% % Read 3-D data into the workspace and prepare it for processing. volData = load('mri'); sz = volData.siz; vol = squeeze(volData.D); %% % Calculate the gradients. [Gmag, Gaz, Gelev] = imgradient3(vol); %% % Visualize the gradient magnitude as a montage. figure, montage(reshape(Gmag,sz(1),sz(2),1,sz(3)),'DisplayRange',[]) title('Gradient magnitude')