Counting just coins in this image !...
Show older comments
Hi
I tried below code to count coins in image and it's work fine :
function ret = CountCoins(img)
subplot(2,2,1);
imshow(img);
subplot(2,2,2);
imgBW = im2bw(img);
imshow(imgBW);
subplot(2,2,3);
imhist(img);
subplot(2,2,4);
imgZ = zeros(size(img));
imgZ(img > 100) = 1;
imshow(imgZ);
ret = round(sum(imgBW(:)) / 2100);
imgConn = bwconncomp(imgZ);
ret = imgConn.NumObjects;
end
I want just count coins no anything else.
Look...
With above function i can count coins in this image :
Result is 10.(Correct)

But result of this image is wrong;
Result is 12.(Wrong)

because 2 shapes are not coins!
_______________________________________
My question:
How can i count "Just" coins on that image?
1 Comment
Walter Roberson
on 1 Mar 2013
Define "coins" in a way that allows them to be distinguished with a picture of the resolution you show.
Accepted Answer
More Answers (0)
Categories
Find more on Image Arithmetic in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!