histogram from binary image
20 views (last 30 days)
Show older comments
Viviana on 1 Nov 2022
Commented: KALYAN ACHARJYA on 4 Nov 2022
Hi, I'am calculating the histogram from a binary image, I am using the following code, but my histogram is empty, besides the grayscale turns out a proper histogram. Can you kindly help me? Thanks a lot.
I = imread('test.png');
[ counts , binLocations ] = imhist(I,2);
KALYAN ACHARJYA on 1 Nov 2022
Edited: KALYAN ACHARJYA on 1 Nov 2022
What does histogram mean: it counts the number of pixels as per pixel values. Binary number has only 0 and 1 pixel, lets have example there can be 500 zero pixels and 200 one pixels. If we draw the histogram plot, the hist blue (default) line bar plot may on the axis itself, please look carefully.
You can use the histogram function, you can do many ways to change the color or width of the hist plot, so that it is easily visualized.
More Answers (0)
Find more on Histograms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!