File Exchange

image thumbnail

structure tensor - introduction and tutorial

version (409 KB) by Shawn Arseneau
Comprehensive intro to structure tensors both in 2D and 3D


Updated 01 Nov 2006

No License

Tutorial on structure tensors. Normally associated with image processing and structure inference, this code provides a completely encapsulated package to explain and demonstrate the use of structure tensors.

playshow structureTensorDemo

or use the html to properly visualize the LaTeX equations.

Comments and Ratings (14)


In function partial_derivative_to_structure_tensor_form,
it seems that it always output a diag matrix. Is it correct?

Sara Salimi

I am beginner in Matlab, and I need to extract structure tensor eigenvalues and eigenvectors combining three different scales (0.65, 1.1, and 2.5) for MRI images (dicom file format).Can we use these codes for this purpose? Your help is appreciated.

You give excellent examples of finding the structure tensor of a 3 dimensional image. I was wondering if you could post an example that finds the structure tensor of a 2d image.


I'd like to ask you about line 28 in structure_tensor_plot.m :

[stheta, sphi, srho] = cart2sph(e3(1), e3(2), e3(3));

Why did you use e3 instead of e1? since l1 >> l2 = l3 (aprox.) , it should be e1 that corresponds (l1). I would appreciate a lot if you answer my inquiry.
Thanks in advance.



nice work

Lin Naiyang

Ben Kang

Great jobs!

S Arseneau

I believe that your issue may be that you are using an older version of MatLab as I see from your directory path that you are using MatLab 6. To provide a quick fix, I suggest looking at your local help file (which should still have your appropriate function parameters) for 'quiver'. Otherwise, I suggest re-coding the source to:
quiver(midpt, midpt, cU, cV);
This won't have any of the cool visualization, but I suspect it may work for your version of MatLab. You can also try to re-code based on the premise that the current version of quiver works as follows:
quiver(xpos, ypos, xMagnitude, yMagnitude, scaleFactor, lineSpec, ...);

Hope that this helps you out.

Emilio Gomez

??? Error using ==> quiver
Too many input arguments.

Error in ==> C:\MATLAB6p5\work\ST_pub\structureTensorDemo.m
On line 81 ==> quiver(midpt, midpt, cU, cV, midpt, 'r', 'LineWidth', 5, 'MaxHeadSize', 5);

dong huang

>> structureTensorDemo
Isotropic Case: Directional Derivative Magnitude=0.000000
Uniform Color Case: Directional Derivative Magnitude=0.000000
Note how the coherence measure is different for each case
Isotropic case coherence:0.000000
Uniform color case coherence:1.000000
??? Undefined command/function 'voxel_plot'.

Error in ==> visualize_3D_data at 30
voxel_plot([c,r,d],vColor, 1-data(c,r,d));

Error in ==> structureTensorDemo at 341


Inclusion of voxel_plot function

MATLAB Release Compatibility
Created with R14SP1
Compatible with any release
Platform Compatibility
Windows macOS Linux

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.

Learn About Live Editor