如何计算2D数组的结构张量? [英] How to compute the Structure Tensor of a 2D array?

查看:211
本文介绍了如何计算2D数组的结构张量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个计算结构如何从二维数组中推广(即结构张量场)?

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

我无法弄清楚我在做什么我做错了实现。在我的例子中,2D数组是2D灰度图像,这里是我使用C ++和Eigen做的一般概述:

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现在是img(0,0)的结构张量,是不是这样?

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

推荐答案

你似乎认为,结构张量不是简单地计算在一个像素 u

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

但是,

其中 w( r 是您选择称重的窗口功能具有(例如高斯)的像素周围。

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

如果从逻辑上考虑它,单个像素的梯度通常不能包含足够的信息来表示结构那个像素。您需要考虑像素的周围环境。因此,我们有一个影响半径 r ,以及影响区域的窗口函数。通过改变 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. 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.

这篇关于如何计算2D数组的结构张量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆