GLCM feature extracted image display
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
i want to view the output images for GLCM calculated features for optical images like in the figure attached. help me with the code.
0 Kommentare
Antworten (1)
Amish
am 30 Apr. 2024
Bearbeitet: Amish
am 30 Apr. 2024
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!
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!