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');
댓글 수: 0
답변 (1개)
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
2016년 7월 6일
How to extract texture features after applying the filter? graycoprops provides only 4 features
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!