GLCM feature extracted image display

12 次查看(过去 30 天)
i want to view the output images for GLCM calculated features for optical images like in the figure attached. help me with the code.

回答(1 个)

Amish
Amish 2024-4-30
编辑:Amish 2024-4-30
Hi Vimal,
You can output images for GLCM calculated features for optical images by using MATLAB script. You will need to read the images, convert them into grayscale versions and the calculate GLCM and then get the GLCM features. You can then display the calculated features or use imagesc to display any direct outputs as an image.
Here is a generic script that you can refer to:
img = imread('your_image.jpg');
% convert it to grayscale
if size(img, 3) == 3
img = rgb2gray(img);
end
% an example GLCM with a distance of 1 and four angles (0, 45, 90, and 135 degrees):
offsets = [0 1; -1 1;-1 0;-1 -1];
glcm = graycomatrix(img, 'Offset', offsets);
% extract features
features = graycoprops(glcm, {'contrast', 'correlation', 'energy', 'homogeneity'});
disp(features);
% OR display any direct outputs
figure;
subplot(2,2,1);
imagesc(glcm(:,:,1));
title('0 degrees');
colorbar;
subplot(2,2,2);
imagesc(glcm(:,:,2));
title('45 degrees');
colorbar;
subplot(2,2,3);
imagesc(glcm(:,:,3));
title('90 degrees');
colorbar;
subplot(2,2,4);
imagesc(glcm(:,:,4));
title('135 degrees');
colorbar;
Here are some documentation links that you may find to be useful:
Hope this helps!
  1 个评论
Vimal Raj
Vimal Raj 2024-4-30
Thank You Amish,
But could you please help me to precise in duplicating the image attached for our own data.
.ie for example, i want to see mean, varaiance, entropy, homogeneity results as image ( not as value) for the given image.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by