To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016
how to find intensity of a gray image?
It depends on what you mean by intensity. I know you've been working, and instructing students at your university, long enough in the image processing field that you know how to take a histogram:
% Let's compute and display the histogram. [pixelCount, grayLevels] = imhist(grayImage); subplot(2, 2, 2); bar(pixelCount); grid on; title('Histogram of original image', 'FontSize', fontSize); xlim([0 grayLevels(end)]); % Scale x axis manually.
and I know that you know how to get the overall mean of the image:
meanGrayLevel = mean2(grayImage);
I know you already know all that. So now we need to have you explain what you mean by "intensity". What you (and most others) may not know is that the units of a standard optical image are NOT intensity. They're lumens-seconds, a form of visible energy. Why? Think of lumens like watts, but just in the visible wavelength. So it's like energy per second. Because you have Lux (lumens per square meter) at the sensor (CCD), and you integrate that over the area (square meters) of a pixel and over time (seconds), then the units are lumen-seconds, kind of like a visible energy. See this for further discussion.
Now, intensity is an SI base unit along with meter, second, ampere, kelvin, mole, and kilogram. Its units are candela. You can not get the luminous intensity of an image - it doesn't make sense. It is a characteristic of the light source, not a surface with light incident on it. Wikipedia goes into a great amount of detail on all these units.
Anyway, we're back to what you mean by intensity. The mean gray level and histogram are too trivial (and you already know those), so please explain exactly what you mean.