GLCM feature extracted image display

조회 수: 14 (최근 30일)
Vimal Raj
Vimal Raj 2024년 4월 30일
댓글: Vimal Raj 2024년 4월 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