Clear Filters
Clear Filters

How to obtain entropy , energy of 3d volumetric image on GLCM features ..?

22 views (last 30 days)
Hello, I am using GLCM for the texture analysis of 3d volumetric image. But i do not solve this . Error as follow:
Error using graycomatrix
Expected input number 1, I, to be two-dimensional.
Error in graycomatrix>ParseInputs (line 260)
validateattributes(I,{'logical','numeric'},{'2d','real','nonsparse'}, ...
Error in graycomatrix (line 167)
[I, Offset, NL, GL, makeSymmetric] = ParseInputs(varargin{:});

Answers (1)

Anusha on 24 Aug 2022
I understand that you are trying to find the GLCM features of a 3-D image (Image3D) and want to calculate the entropy and energy of the obtained GLCM features.
Currently graycomatrix() supports only 2-D intensity images as input. You can convert the 3-D RGB image to an intensity image and obtain the GLCM features as shown below:
% Convert the 3-D RGB image to grayscale
I = im2gray(Image3D)
% Obtain the GLCM features
glcm = graycomatrix(I)
% Calculate energy of the GLCM features
Energy_glcm = graycoprops(glcm,{'energy'})
Please refer to the following documentation for more details regarding “graycoprops“ function : Properties of gray-level co-occurrence matrix - MATLAB graycoprops (

Community Treasure Hunt

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

Start Hunting!