Structure Tensor

Local 2×2 structure tensor of an image, with edge and flow orientation, anisotropy, and the raw tensor.

What it does

Structure Tensor measures the local gradient tensor of an image and reports what it says about each neighbourhood. Orientation is the dominant edge and flow direction. Anisotropy is how strongly the neighbourhood favours that direction, 0 for flat and 1 for a clean edge or ramp. Tensor is the raw result, for anything that wants to do its own maths on it.

When to use it

ParameterTypeDefaultWhat it does
inputRasterImage, or any Field(Color): feeding a normal buffer makes downstream filters follow surface curvature.
opacityNumber1Layer opacity (0 = transparent, 1 = opaque). Editable, wirable, keyframable.

Gotchas

Orientation is a direction encoded into the red and green channels around a midpoint of 0.5, not an angle in radians. Decode it the way a flow map is decoded.

Input has no bypass and no guard for an unconnected pin, so wire something in before reading the outputs.

Anisotropy is the mask worth gating on. Orientation is defined everywhere, including across flat regions where its direction is arbitrary, so an effect steered by Orientation alone will wander wherever the image has no structure.

Worked example

  1. Wire an image into Input.

  2. Wire Anisotropy into a mask input to isolate the textured regions.

  3. Wire Orientation into Displace in Vector mode to push pixels along the local edge direction.

  4. Feed a rendered normal pass in instead of the picture, and the same result follows surface curvature.

See also

Motion Field · Slope · Normal Map · Rasters (images)