Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

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.

2 Comments

Jean 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.

M@lik Ali

Tags

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));

7 Comments

Iain on 25 Jun 2013

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

Mona 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.

Image Analyst
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

mean(imagefile(:))

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..

Adina Stoica
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..?

10 Comments

Image Analyst on 3 Feb 2014

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

Jensa 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.. http://postimg.org/image/pe5ozahzb/e770bd0c/

Image Analyst on 11 Feb 2014

Please start your own discusssion.

Saranya

Contact us