Number of pixel, image outline and image processing

5 views (last 30 days)
I'm still new in Matlab. I had segmented gray scale image into four regions like this.
I would like to calculate area/no. of pixel for each region within each human image. My idea is drawing outline of each human images and then calculate no. of pixel for white, light gray and dark gray regions in the image. Is there any idea to do that, or better idea? What i learnt and found only the method for binary image, not same with this one.
Thanks in advance.

Accepted Answer

Sean de Wolski
Sean de Wolski on 1 Feb 2012
doc bwconncomp
doc regionprops
doc bwarea
  19 Comments
Syahrul Niezam
Syahrul Niezam on 2 Feb 2012
I would like to ask, is there any idea how to do labeling on non-binary image; like image above? What I understand, bwlabel is for binary (black and white) image only. Is it possible to 'recreate' or renovate itself?
Sean de Wolski
Sean de Wolski on 2 Feb 2012
A label image can be _ANY_ image if you choose to treat it as such. That is, you can treat equal intesities as objects.

Sign in to comment.

More Answers (1)

Image Analyst
Image Analyst on 1 Feb 2012
See my image segmentation tutorial: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862. I do that exact thing, except for coins instead of humans.
  8 Comments
Syahrul Niezam
Syahrul Niezam on 2 Feb 2012
I want to apply labeling in above image, so that I can calculate no. of pixel for each levels; white, light gray, dark gray and black.
http://i44.tinypic.com/2nq8piw.jpg
However, I would like to calculate separately for each subject(human and non-human).
I really hope any code, basic or idea to do that.
Image Analyst
Image Analyst on 2 Feb 2012
First use bwareaopen() to get rid of small regions. Then say
binaryImage = yourImage >= 100 & yourImage <= 150; % Or whatever it needs for the range you're interested in.
labeledImage = bwlabel(binaryImage);
measurements = regionprops(labeledImage, 'area');

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!