![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1176353/image.png)
histogram from binary image
13 ビュー (過去 30 日間)
古いコメントを表示
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');
figure;
[ counts , binLocations ] = imhist(I,2);
figure;
imhist(I);
0 件のコメント
採用された回答
KALYAN ACHARJYA
2022 年 11 月 1 日
編集済み: KALYAN ACHARJYA
2022 年 11 月 1 日
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.
Or
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.
I=imbinarize(rgb2gray(imread('1.jpg')));
[counts,binLocations]=imhist(I,2);
figure, histogram(I);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1176353/image.png)
2 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Histograms についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!