Count Object on color

6 views (last 30 days)
hanis nadhirah
hanis nadhirah on 7 Nov 2019
Commented: hanis nadhirah on 9 Nov 2019
Hello , I just use threshold app to isolate object with same color. However , i try use bwlabel to count object from result but it does not count . Can you help me ? Thank you.

Accepted Answer

Image Analyst
Image Analyst on 7 Nov 2019
Call it then call bwlabel():
[BW,maskedRGBImage] = createMask(RGB);
[labeledImage, regionCount] = bwlabel(BW);
regionCount is the count of the colored objects you masked out.
  5 Comments
Image Analyst
Image Analyst on 8 Nov 2019
Thanks for accepting the answer. You might also use bwareafilt() or bwareaopen() to remove noise while leaving the shape of the other blobs unchanged. imopen() and imclose() will change the shape of blobs, which may or may not be acceptable to you. imclose() will tend to make blobs rounder/smoother while imopen() tends to make blobs pointier.
hanis nadhirah
hanis nadhirah on 9 Nov 2019
Thank you for your help , I using bwareafilt() to remove noise and it works!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!