The gradient of an image displays the rate of change of the operand's intensity along the horizontal (left to right), vertical (top to bottom) or depth (front to back) axes. The graph on the left charts the intensity of a one dimensional bell curve image (red), the green curve charts the bell curve's rate of change (or slope). The gradient is closely related to the first derivative, which it approximates, and is computed by taking successive differences of neighboring pixels along a given directional axis.
The format of the command is:
-gradient: axis,scheme
and chooses among several different methods to estimate the gradient.
Both the axis and scheme parameters are optional. Without parameters, the command computes all significant 2d/3d components using a scheme of 3 (rotation invariant).
It is quite common to follow the -gradient command with -append c which folds the output images into one 2 or 3 channel image of a special character called a 2 or 3D direction field. Each pixel may be regarded as a vector and the overall image a vector field.
In the case of -gradient's output, the vector field encodes the pointwise direction and magnitude of intensity gradients observed in the original image.
Such vector fields may be visualized with -quiver, rendering the field with arrow markers, or -direction2rgb, rendering the field with color. We may extract the vector lengths with -norm and their directions, or orientations with -orientation. The -divergence command estimates pointwise outflow and inflow of vector fields.
The -warp command employs 2D direction fields as the object controlling image distortion. The command -eigen2tensor takes pairs of vector fields and transforms them into tensor fields. In this operation, the first vector field contain pairs of eigenvalues and the second is a field of unit vectors (an orientation field), representing one of two eigenvectors per tensor. The other one may be inferred as it points in a 90° direction from the first. Tensor fields are used in encoding image structure and making smoothing geometries.
A bell curve from above ( Running: |
Horizontal gradient of the bell curve on the left ( Gray maps to zero in this image and represents unchanging regions in |
Vertical gradient of the bell curve on the far left (cubic.png ). But for orientation, the particulars of this image are the same as the horizontal gradient on the immediate left. |
A Isophysis tasmanica Tasmania, Australia. (
|
We generate gradients in both the x and y directions and append these two images into the horizontal and vertical channels of a vector field. |
We take the norm of this vector field, obtaining an image where dark lines trace the rapidly changing gradients of the original image. |
Garry Osgood