简体   繁体   中英

How to compute the Structure Tensor of a 2D array?

How does one compute structure tensors from a 2D array (ie, structure tensor field)?

I can't figure out what I'm doing wrong in my implementation. In my case the 2D array is a 2D grey-scale image, and here is a general overview of what I'm doing using C++ and Eigen:

// the 2D grey-scale image, represented by a 2D array of doubles
ArrayXXd img;

// compute the gradient vector field, which produces a 2D array of 2D vectors
typedef Array<Vector2d, Dynamic, Dynamic> ArrayXXv2;
ArrayXXv2 g = gvf(img);

// compute the outer-product of each element in g to get a 2x2 matrix, e.g.,
Matrix<double, 2, 2> st00 = g(0,0) * g(0,0).transpose();

st00 is now the structure tensor of img(0,0), is that not so?

From you seem to think, the structure tensor is not simply calculated at one pixel u as,

在此处输入图片说明

but as,

在此处输入图片说明

where w( r ) is a window function you choose to weigh the surroundings of the pixel with (a Gaussian for example).

If you think about it logically, the gradient at a pixel alone can not generally contain enough information to represent structure at that pixel. You need to consider the surroundings of the pixel. Therefore we have a radius of influence r , and a window function in the region of influence. By varying r , you can choose the scale of the structure you want to look at.

Once you have calculated the structure tensor at every pixel, you can compose the structure tensor field by calculating the eigenvector corresponding to the eigenvalue with least magnitude for each structure tensor.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM