# Computing structure tensors

As far as I understand, the structure tensor is:

$$M = \sum_{(x,y) \in W} \begin{bmatrix} I_x^2 & I_xI_y \\ I_xI_y & I_y^2 \end{bmatrix} = \begin{bmatrix} \sum_{(x,y) \in W} I_x^2 & \sum_{(x,y) \in W} I_xI_y \\ \sum_{(x,y) \in W} I_xI_y & \sum_{(x,y) \in W} I_y^2 \end{bmatrix}$$

How do I compute $$I_x^2, I_y^2, I_xI_y$$. I used Hadamard product for compute $$I_x^2, I_y^2, I_xI_y$$. But if I use Hadamard product, I will get $$\det(M) = 0$$. I'm stuck in here for too long. Can anyone help?

• Do you know what $I_x,I_y$ are? If so, I don't see any difficulty, beyond programming, which is off-topic here. May 20 '20 at 14:25
• Where does Hadamard product come in? It's not there in the formulas. May 20 '20 at 14:26
• Sorry,my misunderstanding. $I_x, I_y$ are just scalars. But if $I_x,I_y$ are scalars. I'll get $det(M)=0$, $tr(M) = \sum_{(x,y)\in W } (I_x^2 + I_y^2)$, and $W$ contains more than single point. Why when $W$ contains more than contains more than single point $det(M) \nequiv 0$? May 20 '20 at 18:38
• I agree with your trace formula, but not with your formula for the determinant. Suppose for example that the first point has $(I_x,I_y) = (1,0)$, and the second one has $(I_x,I_y) = (0,1)$ (and there are no other points). Then $M$ is the identity matrix, which has nonzero determinant. May 20 '20 at 18:40
• The formula to the determinant is just not what you wrote. You're putting the sum in the wrong place. It's not true in general that $\det(A+B) = \det A + \det B$. May 20 '20 at 19:52