# How can I find the intensity value which has the maximum number of pixels in the histogram? I'm using grayscale image. please I need a code ..

7 views (last 30 days)

Show older comments

how can find a function to solve this?

##### 0 Comments

### Accepted Answer

Walter Roberson
on 16 Oct 2016

[counts, edges] = histcounts(YourIntensityImage(:), 0:255);

[maxcount, maxidx] = max(counts);

most_common_intensity = edges(maxidx);

##### 14 Comments

Image Analyst
on 17 Oct 2016

You might try a modified median filter, like my attached code.

### More Answers (1)

Image Analyst
on 16 Oct 2016

### See Also

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!