imgradient3() - Image Processing
[Gmag,Gazimuth,Gelevation]
= imgradient3(I) returns the gradient
magnitude, Gmag, gradient direction, Gazimuth,
and gradient elevation Gelevation for the grayscale
or binary 3-D image I.[Gmag,Gazimuth,Gelevation]
= imgradient3(I,method) calculates
the gradient magnitude and direction using the specified method.[Gmag,Gazimuth,Gelevation]
= imgradient3(Gx,Gy,Gz) calculates
the gradient magnitude and direction from the directional gradients
along the X-axis, Gx, Y-axis, Gy and Z-axis, Gz. Code Generation support:
Yes.MATLAB Function Block support:
Yes.
Syntax
[Gmag,Gazimuth,Gelevation]
= imgradient3(I) example[Gmag,Gazimuth,Gelevation]
= imgradient3(I,method)[Gmag,Gazimuth,Gelevation]
= imgradient3(Gx,Gy,Gz)
Example
Compute 3-D Gradient Magnitude and Direction Using Sobel MethodOpen This Example
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')
Output / Return Value
Limitations
Alternatives / See Also
Reference