Count elements on image

6 vues (au cours des 30 derniers jours)
Matías
Matías le 15 Sep 2015
Hi all,
I had two problems when I used the next code for counting circles on the attached images (erodedBW is the image input)
subplot(2, 2, 1);imshow(A);
fontSize = 20;
binaryImage = erodedBW(:,:,1) < 200;
title('Original', 'FontSize', fontSize);
subplot(2, 2, 2);imshow(A);
title('Binary Image with Centroids', 'FontSize', fontSize);
hold on;
format longg;
format compact;
measurements = regionprops(erodedBW, 'Centroid', 'Area');
numberOfCircles = length(measurements);
allAreas = [measurements.Area]
for k = 1 : numberOfCircles
centroid = [measurements(k).Centroid];
xCenter = centroid(1);
yCenter = centroid(2);
plot(xCenter, yCenter, 'b+');
[counts values] = hist(allAreas);
subplot(2, 2, 3);imshow(erodedBW);
title('Eroded', 'FontSize', fontSize);
message = sprintf('The number of circles is %d', numberOfCircles);
msgbox(message);
The first problem is that the algorithm counts a circle in the center. And the other is that counts more than one circle on the same element.
I need detect two elements (the two blobs)
I need detect two blobs on the left.
Thanks

Réponses (0)

Catégories

En savoir plus sur Image Processing Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by