필터 지우기
필터 지우기

How to count number of objects in the image, compute their areas, and make probability distribution of the areas?

조회 수: 2 (최근 30일)
Hello friends,
I just would like to know how to calculate the objects of image and do the area distribution.
Thanks so much in advance.

채택된 답변

Image Analyst
Image Analyst 2022년 12월 30일
In your other question, I saw that you already have a segmented image. So in that case, you can get an area distribution like this
props = regionprops(mask, 'Area');
histogram([props.Area]);
grid on;
title('Histogram of Areas');
xlabel('Area');
ylabel('Count');
  댓글 수: 4
Jialin Men
Jialin Men 2022년 12월 30일
Hallo Image Analyst,
I have clicked the Accept this answer.
I have another question.
If I want to know the number of pixels of each particle in this image,
I could also use as below ? right?
props = regionprops(mask, 'PixelValue');
histogram([props.PixelValue]);
Image Analyst
Image Analyst 2022년 12월 31일
편집: Image Analyst 2022년 12월 31일
No, that's not right. PixelValue is a list of gray levels of all the pixels in each blob. If you want to know the number of pixels in each blob, you need to ask for 'Area':
props = regionprops(mask, 'Area');
allAreas = [props.Area]
You might use bwmorph and use things like the 'bridge' option to break apart barely touching particles. You might also look at watershed. See these links:

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by