The -display_tensors command visualizes 2x2 tensor fields, taking such as input operands. For each pixel (tensor) in the field, the command renders an ellipse with axes that are proportional to the two eigenvalues. The semimajor axis aligns with the the steepest gradient in the locale and the eigenvector pointing along it.

Especially flat or highly eccentric ellipses reflect large differences in the magnitude of the two eigenvalues. The relative discrepancy of the two eigenvalues reflects the degree of anisotropy or bias toward a particular orientation. Rounder ellipses arise from eigenvalues closer together in value and reflect gradients that are not as strongly oriented in a particular direction.

The overall saturation and luminance of the ellipse reflect the magnitude of the largest eigenvalue and the rapidity of change of the local gradient.

As a practical matter, the command works best on relatively small images. Tensor maps with ≈1000 pixel dimensions can take some minutes to display and may furnish too much information for ready comprehension. It is generally easier to locate an area of interest in an earlier rendering pass, then crop the region of interest to image sizes of about 100 pixels or less, then render these excerpts with -display_tensors.

The accompanying illustration visualizes the structure tensor field of the 32x32 pixel excerpt from a larger gray scale image, far upper left, here magnified 4 times. The near upper left image is a structure tensor field of that excerpt; -display_tensor produced the visualization of this field, the large bottom illustration. The two small images near and far right are the output images of -eigen, here for comparison.

-display_tensors take the following parameters:

  1. _size_factor>0: A multiplier indicating how much larger the display should be rendered with respect to the original. Optional, Defaults to a factor of 16
  2. _ellipse_factor>=0: A multiplier which scales ellipses with respect to the overall display, however large or small it may be. At a factor of 1.0, the size of the ellipses stems from the eigenvalues latent in the tensors. Should there be significant overlap among ellipses, a smaller ellipse factor may make the overall presentation intelligible. Similarly, where gradients are very small, an ellipse_factor greater than one may be necessary to perceive slight variations. Optional, and defaults to 0.92.
  3. _colored_mode={ 0 | 1 }: A boolean flag. When set, the ellipses will be colored to indicate the direction of the tensor's gradient vector. Optional, and defaults to 1.  (True)

Garry Osgood