to take histogram of image pixels

2 views (last 30 days)
POOJA KJ
POOJA KJ on 13 Mar 2015
Commented: Image Analyst on 13 Mar 2015
sir, i have to Take a histogram of image pixels. I use nBins=100 equally spaced between [0,1]. can u tell the code for this

Answers (1)

Image Analyst
Image Analyst on 13 Mar 2015
[pixelCounts, grayLevels] = imhist(grayImage, nBins);
  2 Comments
POOJA KJ
POOJA KJ on 13 Mar 2015
where should i specify the spacing of 100 bins from 0 to 1
Image Analyst
Image Analyst on 13 Mar 2015
It's done automatically if grayImage is a double image, not uint8.
If you don't trust it, you can use histc()
edges = linspace(0,1,100);
counts = histc(grayImage, edges);

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!