how to count the different dots seperately
1 次查看(过去 30 天)
显示 更早的评论
I have an image with red dots ,green dots and yellow dots. some dots are touching eachother. (2 pixels) and some dots are alone (1pixel) I would like to have a count of red dots, green dots, yellow dots and the number of touching dots. Can someone tell me how this can be achieved. I am attaching the image here.
Thank You
0 个评论
回答(1 个)
Image Analyst
2014-7-1
Extract the color channels
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
Then threshold and label
redDots = redChannel > 100; % or whatever
[!, numberOfRedDots] = bwlabel(redDots);
greenDots = greenChannel > 100; % or whatever
[!, numberOfgreenDots] = bwlabel(greenDots);
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!