File Exchange

image thumbnail

Sparse set of Features for Texture Discrimination

version (104 KB) by Omid Aghazadeh
This package implements the Features mentioned in the PhD thesis of Thomas Brox.

1 Download

Updated 18 May 2010

View Version History

View License

The feature vector is a 5(gray scale) or 15(colored) dimensional vector reflecting the contrast, texture strength and orientation and texture scale for each pixel. Texture scale is represented by the average speed of change of pixel intensity in a Total Variation framework while the texture strength and orientation are computed from 3 distinct components of the structure tensor undergone a nonlinear coupled isotropic matrix valued diffusion. The feature vector can directly be used in a texture segmentation framework.
You need to download the Nonlinear Coupled Diffusion package (submission 27604 available at to run this code.
The code is commented and the definitions of the input/output variables and usages are mentioned in the header of the discriminative_texture_feature.m. A sample script test_discriminative_texture shows the usage of the code as well as the usefulness of the gaussian regularization for speedups in the nonlinear diffusion process.
Note that you need to compile the mex file: thomas_mex.cpp before the first usage.

Cite As

Omid Aghazadeh (2020). Sparse set of Features for Texture Discrimination (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (4)


sallam agaye mohandes

man dar morede *Age estimation from facial image* kar mikonam. aya mishe az in Code baraye analysis va estekhraje vizegihaye chorooke chehre (mesle pishanii) estefade kard?

mamnoon misham sge rahnemayiim konid??


ah sure, but it is still not working with the same error.

tex = discriminative_texture_feature(I);
[sy sx d] = size(I);
tmp = zeros(size(I));
for i = 1 :size(tex,1)
tmp(i) = reshape(tex(i,:),[sy sx]);
textureimg = tmp(5);

My I size is: sy = 370, sx = 427, d = 3
and the size from tex is sy = 5, sx = 157990, d = 1

Omid Aghazadeh

you need to get the size of the original image and not that of the result.


The code works great with the demo images but when I use my images there is an error:
??? Error using ==> reshape
To RESHAPE the number of elements must not change.

Error in ==> gettexture at 47
tmp(i) = reshape(tex(i,:),[sy sx]);

I'm using only the last one of the 5 images.
tex = discriminative_texture_feature(I);
[sy sx d] = size(tex)
for i = 1 :size(tex,1)
tmp(i) = reshape(tex(i,:),[sy sx]);
textureimg = tmp(1);

Where is my fault?

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

Inspired by: Nonlinear Coupled Diffusion

Inspired: Nonlinear Coupled Diffusion

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!