Number of pixel, image outline and image processing
Show older comments
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
More Answers (1)
Image Analyst
on 1 Feb 2012
0 votes
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
on 2 Feb 2012
Image Analyst
on 2 Feb 2012
Yes.
Syahrul Niezam
on 2 Feb 2012
Image Analyst
on 2 Feb 2012
It is not for a binary image. It uses a gray scale image, just like you do. There is a binary image that defines where you look in the gray scale image to compute areas and intensities, etc. but the original image is still gray scale and you should be able to adapt it very easily to your image. Very easily.
Syahrul Niezam
on 2 Feb 2012
Image Analyst
on 2 Feb 2012
You can't do labeling on a non-binary image. It doesn't make sense. You have to have an image that separates your image into foreground and background, and that is a binary image. How can you do anything without deciding what is foreground and background? Tell me, does your image have a foreground? Of course it does.
Syahrul Niezam
on 2 Feb 2012
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');
Categories
Find more on Region and Image Properties in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!