필터 지우기
필터 지우기

I have segmented a image using region growing. Now i want to count number of pixels in each regions. How can i do that?

조회 수: 1 (최근 30일)
I have segmented a image using region growing. Now i want to count number of pixels in each regions. How can i do that? i want all the regions which have less than 100 pixels.

답변 (1개)

Image Analyst
Image Analyst 2014년 6월 20일
% Extract only small blobs:
bigBlobs = bwareaopen(binaryImage, 100);
smallBlobs = binaryImage - bigBlobs;
% Measure areas
labeledImage = bwlabel(smallBlobs);
measurements = regionprops(labeledImage, 'Area');
allAreas = [measurements.Area]
  댓글 수: 2
Macarena Santillan
Macarena Santillan 2021년 5월 14일
Where is the part that counts the pixels? I hace a similar issue. I am trying to find the amount of pixels enclosed in a region of my image. But I am not sure in which part of the code you jus typed are you extracting that number. Why are you measuring areas?
Image Analyst
Image Analyst 2021년 5월 14일
The regionprops() function is the part that counts all the pixels in each region.
allAreas is a vector that counts the number of pixels in each region. For example if your mask had two regions with 12000 and 25000 pixels, then allAreas would be [12000, 25000]
I am measuring areas because area has units of pixels and the area is the count of the number of pixels in the region.

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by