MATLAB Answers

M@lik Ali

Image Intensity

Asked by M@lik Ali
on 4 Jun 2012
Latest activity Commented on by Image Analyst
on 11 Feb 2014

Hi all, Can any one tel me the command in matlab to calculate the intensity of image.


on 5 Jul 2013

Does anyone further know how to do this for a specific area of pixels? For example, image(100:1:200,100:1:200) for a 100 by 100 pixel area, and get the intensity in this area as an average?

Image Analyst
on 5 Jul 2013
meanGrayLevel = mean2(yourImage(100:200,100:200));

Don't use "image" as the name of your variable since it's a function.

3 Answers

Answer by Image Analyst
on 4 Jun 2012
 Accepted answer

The mean of a particular pixel is just simply the pixel value, since there is only one sample - nothing really to take the mean of:

intensityValue = grayImage(100, 230); 
meanIntensityValue = mean(grayImage(100, 230)); 

Here, of course meanIntensityValue will equal intensityValue.

To get the mean of all the pixel values in the entire image, you can do any of these:

meanIntensityValue = mean2(grayImage);
meanIntensityValue = mean(grayImage(:));
meanIntensityValue = mean(mean(grayImage));


on 25 Jun 2013

Yes. Both should work. (Though, you have a spare "=" in the first one).

on 26 Jun 2013

Thank you so much

Image Analyst
on 26 Jun 2013

Please mark the discussion as "Answered" if you're done with it. Unless you want to open a can of confusing worms about how the units of an image are not really intensity.

Answer by Adina Stoica
on 4 Jun 2012

Well, the intensity of the image is the average of the intensities of all pixels in an image (unless you're doing anything more specific than that). So if you do


you should get the intensity of the image.

  1 Comment

M@lik Ali
on 4 Jun 2012

Adina thanks for your response,

But actually i want to calculate the intensity value of all elements of the images.

someone told me like

intensityValue = grayImage(100, 230);

But in i have to calculate the intensity value of each pixel or total image, i think i can do it by calculating the intensity of each pixel and then add it but i am not sure.

Kindly help me about it..

Answer by Saranya
on 30 Jan 2014

hi image analyst i want to measure the intensity profile for gray scale image.. can you help me..?


Image Analyst
on 3 Feb 2014

Yes. improfile() can take arguments that are the endpoints of the line.

on 11 Feb 2014

Hi Image Analyst...Can you help me to find the density profile for my chromosome image..Attaching the image along with this..

Image Analyst
on 11 Feb 2014

Please start your own discusssion.

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!