How to calculate to structure tensor? Structure Tensor is a matrix in form:

$S=\begin{pmatrix} W \ast I_x^2 &amp; W \ast (I_xI_y)\\ W \ast (I_xI_y) &amp; W \ast I_y^2 \end{pmatrix}$

where $W$ is a smoothing kernel (e.g a Gaussian kernel) and $I_x$ is gradient in the direction of $x$ and so on.

Therefore,size of structure tensor is $2N \times 2M$ (were $N$ is the image height and $M$ is its width). However it is supposed to be $2\times2$ matrix to decompose eigenvalues such that we obtain $\lambda_1$ and $\lambda_2$ as it is mentioned in many papers.

So, how to calculate $S$ matrix?
The $S$ matrix is finally of $2\times2$ the size of the initial image. Gathering it is a bigger image is somehow misleading. You effectively get a $2\times 2$ matrix at each pixel of the original image, by gathering values from the $4$ submatrices at corresponding locations. 

Structure tensor provides local information. Do not forget to use smoothed directional derivatives as well when computing $I_x$ and $I_y$. You can for instance compute them with Difference of Gaussians (DoG) operators.
More discussion in  How do I implement the Structure tensor (in Matlab)? or Structure tensor tutorial.