## Image Intensity

### M@lik Ali (view profile)

on 4 Jun 2012
Latest activity Commented on by Image Analyst

on 11 Feb 2014

### Image Analyst (view profile)

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

Jean

### Jean (view profile)

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

### Image Analyst (view profile)

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.

## Products

### Image Analyst (view profile)

on 4 Jun 2012

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

Iain

### Iain (view profile)

on 25 Jun 2013

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

Mona

### Mona (view profile)

on 26 Jun 2013

Thank you so much

Image Analyst

### Image Analyst (view profile)

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.

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.

M@lik Ali

### M@lik Ali (view profile)

on 4 Jun 2012

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.

### Saranya (view profile)

on 30 Jan 2014

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

Image Analyst

### Image Analyst (view profile)

on 3 Feb 2014

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

Jensa

### Jensa (view profile)

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

### Image Analyst (view profile)

on 11 Feb 2014

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