How to count annotation dots from am image?
Afficher commentaires plus anciens
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
Réponse acceptée
Plus de réponses (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.)
Catégories
En savoir plus sur Image Processing and Computer Vision dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
