Energy (uniformity) of an image

15 views (last 30 days)
Anas Saleh
Anas Saleh on 12 Jul 2022
Answered: Image Analyst on 8 Sep 2023
Hello everyone
We know as illustrated in the help center in MathWorks, the graycoprops will compute the Energy of an image as the following:
Returns the sum of squared elements in the GLCM.
Range = [0 1]
Energy is 1 for a constant image
What is the used fromula ?
because ,absolutely, when we sum of squared elements in the GLCM the resluts will not be equals to the values in this range i.e. 0 to 1.
Can you give me an example of code that uses (caculates) the uniformity of an image?
Thanks

Answers (2)

Poorna
Poorna on 8 Sep 2023
Hi Anas Saleh,
I understand that you want to know that underlying implementation to calculate the energy of an image. As you mentioned, the formula for calculating the energy is to sum the squares of all elements in the GLCM. But before doing that, GLCM is normalized so that the sum of all elements of the matrix equals to 1.
The following code will give you the same result as the graycoprops function.
glcm_norm = glcm ./ sum(glcm(:));
foo = glcm_norm.^2;
energy = sum(foo(:));
disp(energy);
Hope this helps!

Image Analyst
Image Analyst on 8 Sep 2023
Depends on what you mean by energy. Pixel values are, for a reflective image like taken with a regular video camera, already in units of energy (scaled to the digital converter you use like 0-255). Just follow the units where you have a certain amount of photons (energy) hitting an area (the pixel area) for a certain amount of time.
pixel value = (ergs/second) / area * (pixel area) * (seconds of integration time) * (ADC Scaling Factor)
so multiplying that all out:
pixel value = ergs * (ADC Scaling Factor).
So the energy in the entire image is proportional to the sum of the gray levels.
The "energy" computed by graycoprops is a different definition of energy, and uses the sum of the gray level neighbor delta values squared.

Community Treasure Hunt

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

Start Hunting!