Count elements on image
6 ビュー (過去 30 日間)
古いコメントを表示
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
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Image Processing Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!