How to count annotation dots from am image?
Show older comments
I'm trying to localize people from an image with annotations. I need to count number of annotations in amoving window. How can I do that? A sample image is attached
Accepted Answer
More Answers (1)
Say the color of the dot is [0, 0, 255]. First convert the image to a logical matrix:
BW = im(:, :, 1) == 0 & im(:, :, 2) == 0 & im(:, :, 3) == 255;
Now BW is 1 where it's blue in the original image and 0 otherwise. Then
[~, num] = bwlabel(BW)
gives you what you need. (You'll need the image processing toolbox for bwlabel.)
Categories
Find more on Image Processing and Computer Vision in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!