calculate the structure tensor eigenvalues of an image in matlab

To calculate the structure tensor eigenvalues of an image in Matlab, you can use the structureTensorEigenvalues function from the Computer Vision System Toolbox. Here's an example:

main.m
% Read image
I = imread('cameraman.tif');

% Calculate structure tensor eigenvalues
opts = struct('GradientType', 'prewitt'); % specify gradient type
[E1, E2] = structureTensorEigenvalues(I, opts);

% Display results
figure;
subplot(1,3,1); imshow(I); title('Original image');
subplot(1,3,2); imshow(E1, []); title('Eigenvalue 1');
subplot(1,3,3); imshow(E2, []); title('Eigenvalue 2');
387 chars
13 lines

In this example, we first read in the image using imread. Then, we specify the gradient type we want to use (in this case, the Prewitt filter) in the opts structure. Finally, we pass the image and opts to structureTensorEigenvalues to obtain the eigenvalues, which are stored in E1 and E2. We then display the original image and the two eigenvalues using imshow. The [] argument in imshow tells Matlab to automatically scale the pixel values to the full range of the display.

gistlibby LogSnag