What should I do to extract texture features now?

1 view (last 30 days)
This is the code for segmentation of an image. I want to extract the texture features of the image. What should I do now? Please help me.
clc;
he = imread('t1.jpg');
imshow(he), title('Apple image');
text(size(he,2),size(he,1)+15,...
'Image courtesy of Alan Partin, Johns Hopkins University', ...
'FontSize',7,'HorizontalAlignment','right');
cform = makecform('srgb2lab');
lab_he = applycform(he,cform);
ab = double(lab_he(:,:,2:3));
nrows = size(ab,1);
ncols = size(ab,2);
ab = reshape(ab,nrows*ncols,2);
nColors = 3;
% repeat the clustering 3 times to avoid local minima
[cluster_idx cluster_center] = kmeans(ab,nColors,'distance','sqEuclidean', ...
'Replicates',3);
pixel_labels = reshape(cluster_idx,nrows,ncols);
imshow(pixel_labels,[]), title('image labeled by cluster index');
segmented_images = cell(1,3);
rgb_label = repmat(pixel_labels,[1 1 3]);
for k = 1:nColors
color = he;
color(rgb_label ~= k) = 0;
segmented_images{k} = color;
end
imshow(segmented_images{1}), title('objects in cluster 1');
imshow(segmented_images{2}), title('objects in cluster 2');
imshow(segmented_images{3}), title('objects in cluster 3');

Answers (1)

Image Analyst
Image Analyst on 17 Mar 2014
Well that code does not do it. It does color segmentation. To do a texture segmentation you want to get a gray level image such as by taking one color channel or using rgb2gray() or by using rgb2hsv and taking one of the channels such as the v channel. Then use stdfilt() or entropyfilt() or a filter of your own.
  2 Comments
Preeti
Preeti on 6 Jul 2016
How to extract texture features after applying the filter? graycoprops provides only 4 features
Image Analyst
Image Analyst on 6 Jul 2016
Like I said, create "a filter of your own." If you know those are not enough or what you want, then what other properties do you want?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!