histogram from binary image

조회 수: 19 (최근 30일)
Viviana
Viviana 2022년 11월 1일
댓글: KALYAN ACHARJYA 2022년 11월 4일
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);

채택된 답변

KALYAN ACHARJYA
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);
  댓글 수: 2
Viviana
Viviana 2022년 11월 3일
Thanks for you help.
I'm just a begginer, using matlab for the first time for my master degree thesis
KALYAN ACHARJYA
KALYAN ACHARJYA 2022년 11월 4일
Welcome to Matlab World!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Histograms에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by