how to count the different dots seperately
3 ビュー (過去 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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/165080/image.png)
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!