## how to calculate intensity of an image

on 6 Feb 2013

### Image Analyst (view profile)

i wanted to calculate intensity of an image... please could someone help me.....

vipul utsav

### vipul utsav (view profile)

on 6 Feb 2013

if you want single value of intensity you can take mean(total image(:)) otherwise every element of image represents intensity

## Products

No products are associated with this question.

### Image Analyst (view profile)

on 6 Feb 2013

There is nothing to do. The image is already the intensity.

Elysi Cochin

### Elysi Cochin (view profile)

on 7 Feb 2013

sir i'm getting error when i do so....

`    ??? Undefined function or variable 'intensity_value'.`
```    Error in ==> Untitled at 9
binaryImage = (yourImage == intensity_value);```

but when i did as below no error... is what i did correct??

```    [filename pathname]=uigetfile('*.png','Select An Image');
```    grayImage=rgb2gray(yourImage);
binaryImage = im2bw(grayImage);```
`    numPixels = sum(binaryImage(:))`
```    measurements = regionprops(binaryImage, 'area');
allAreas = [measurements.Area];```
`    % To find the largest area:`
```    [sortedAreas sortIndexes] = sort(allAreas, 'descend');
largestArea = sortedAreas(1)```
`    largestAreaWithTolerance = 1.1 * largestArea`
Image Analyst

### Image Analyst (view profile)

on 7 Feb 2013

That paper says you have to take the whole histogram of a 10 by 10 chunk of your image, which I guess slides along the image. Then, for that histogram of the 10x10 block, it wants you to find the tallest bin - the max of the histogram. Then it asks you to sum the histogram bins from that bin minus 10 to that bin + 10 gray levels, but excluding the tallest bin itself. This was not well explained by your original wording. Even the papers wording is not optimal. For example using "area" to describe a sum of bins. Yes, I guess it is an area but those pixels represented by those bins may be scattered all over the image and might not even touch each other so it's not like the area of some contiguous blob in the image, which is what I thought from your description.

So, scan the image, say with blockproc(). Then get the histogram in a 10x10 block with imhist() or hist(). Then use max() to find the tallest bin location. Then use sum() to sum between that bin-10 and that bin+10 and subtract the value of the tallest bin. I don't really know what this means, but that's what they ask for. Give it a shot. I told you step by step the functions to use. Search for a blockproc demo that I've posted in Answers if you need help with blockproc.

Elysi Cochin

### Elysi Cochin (view profile)

on 9 Feb 2013

thank u sir..

#### Join the 15-year community celebration.

Play games and win prizes!

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