How to find energy of the image
Show older comments
Please help me to find energy of the image given by equation,
E(x) = for i=1 to x (p(x))
Answers (1)
Image Analyst
on 3 Feb 2014
What is p? The units of images are gray levels, and gray levels are units of energy (joules). Why? Well because you have radiation falling on a sensor. That's watts per square meter or joules per second per square meter. But the sensor has an area and it collects photons for a limited time so you multiply by the area of the pixel and the integration time of the pixel and you get joules. So to get the energy in an image you have to sum up all the gray levels.
totalEnergy = sum(imageArray(:));
What is x and p in your equation? Why is E a function of x (whatever x is)?
7 Comments
aarti sawant
on 3 Feb 2014
Image Analyst
on 3 Feb 2014
What are x and i? What is the energy dependent on? Distance? Location? What?????
You can get the PDF (Probability Density (not distribution) Function) from imhist:
[pixelCounts, grayLevels] = imhist(imageArray);
aarti sawant
on 3 Feb 2014
Image Analyst
on 3 Feb 2014
Edited: Image Analyst
on 3 Feb 2014
The p will sum to 1, by definition. If it doesn't, it's not a PDF.
[pixelCounts, grayLevels] = imhist(imageArray);
pdf = pixelCounts / sum(pixelCounts); % Sum of all pdf elements = 1.
cdf = sumsum(pdf); % Cumulative Distribution Function, if needed.
Why won't you answer my question about what x is? This is the third time I'm asking.
aarti sawant
on 3 Feb 2014
Dishant Arora
on 3 Feb 2014
h you calculated above in turn comes out to be PDF, it's quite obvious that you will get 1 as answer by summing up h. As mentioned earlier by Image analyst you can simply add up all the pixel values in image to get the energy, why complicate it
Image Analyst
on 3 Feb 2014
Edited: Image Analyst
on 3 Feb 2014
aarti, please read this: http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup
Plus those for loops aren't needed and nullifying zeros in h isn't needed. You could do this:
zeroPixelLocations = (a == 0); % Find all zeros.
a(zeroPixelLocations ) = 1; % Set to 1 instead of 0.
h = imhist(a, 256);
h = h / numel(a); % a must be grayscale if you use numel.
E = sum(h(:))
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!