how to count the different dots seperately

3 ビュー (過去 30 日間)
Yuvashree Mani Urmila
Yuvashree Mani Urmila 2014 年 7 月 1 日
回答済み: Image Analyst 2014 年 7 月 1 日
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

回答 (1 件)

Image Analyst
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);

Community Treasure Hunt

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

Start Hunting!

Translated by