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!