In mathematics, the structure tensor, also referred to as the second-moment matrix, is a matrix derived from the gradient of a function. It summarizes the predominant directions of the gradient in a specified neighborhood of a point, and the degree to which those directions are coherent. The structure tensor is often used in image processing and computer vision.
For a function of two variables p=(x,y), the structure tensor is the 2×2 matrix
where and are the partial derivatives of with respect to x and y; the integrals range over the plane ; and w is some fixed "window function", a distribution on two variables. Note that the matrix is itself a function of p=(x,y).