Energy, which is as follows:

can be found based on the MATLAB documentation using:
stats = graycoprops(glcm, properties)
For example, I typed this:
>> a = [1 2; 3 4]
a =
1 2
3 4
>> stats = graycoprops(a, {'energy'})
stats =
Energy: 0.3000
If we want to do this manually, how did we get the energy value shown above?
This is the part I didn't get clearly.
If I'm not wrong:
ans=sum(a(:).^2)/sum(a(:)).^2
来源:https://stackoverflow.com/questions/14599816/calculating-energy-using-matlab