What should I do to extract texture features now?

1 次查看(过去 30 天)
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');

回答(1 个)

Image Analyst
Image Analyst 2014-3-17
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 个评论
Preeti
Preeti 2016-7-6
How to extract texture features after applying the filter? graycoprops provides only 4 features
Image Analyst
Image Analyst 2016-7-6
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?

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by