to take histogram of image pixels
1 view (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Image Analyst
on 13 Mar 2015
[pixelCounts, grayLevels] = imhist(grayImage, nBins);
2 Comments
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);
See Also
Categories
Find more on Histograms in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!