简体   繁体   English

如何计算二维数组的结构张量?

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

How does one compute structure tensors from a 2D array (ie, structure tensor field)? 一个如何从2D数组(即结构张量场)计算结构张量?

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: 就我而言,2D数组是2D灰度图像,这是我使用C ++和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? st00现在是img(0,0)的结构张量,不是吗?

From you seem to think, the structure tensor is not simply calculated at one pixel u as, 从您看来,结构张量不是简单地在一个像素u上计算的,

在此处输入图片说明

but as, 但是

在此处输入图片说明

where w( r ) is a window function you choose to weigh the surroundings of the pixel with (a Gaussian for example). 其中w( r是一个窗口函数,您可以选择使用该函数来加权像素的周围环境(例如,高斯)。

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. 因此,我们有一个影响半径r ,在影响区域有一个窗函数。 By varying r , you can choose the scale of the structure you want to look at. 通过改变r ,您可以选择要查看的结构的比例。

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. 一旦在每个像素处计算了结构张量,就可以通过计算与每个结构张量的幅度最小的特征值相对应的特征向量来组成结构张量字段。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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