Area/Number of pixel in gray-scale image

2 次查看(过去 30 天)
I'm sorry for asking the same question as previous. I'm trying to calculate area/no. of pixel in this image.
I want to calculate no of pixel in white, light gray and dark gray regions separately. I'm very thankful that some of people for some tips. I had tried using bwconncomp and regionprops after binarizing the image. However, error came out for the bwconncomp line.
I'm also trying the labeling process to find area, but the labeling process is failed too.
I hope anybody can help to solve my problems. Thanks in advance.

回答(1 个)

Image Analyst
Image Analyst 2012-2-8
Did you try something like
binaryImage = grayImage == 200; % Or whatever
measurements = regionprops(binaryImage, 'area');
allAreas = [measurements.Area];
bwconncomp is done implicitly inside regionprops if you pass regionprops a logical image instead of a labeled image or connected components structure.
  2 个评论
Syahrul Niezam
Syahrul Niezam 2012-2-8
I tried like this
y=bwlabel(b);
x=uint8(y);
C = bwconncomp(x);
CC = labelmatrix(C);

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Image Segmentation and Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by