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?
Best Answer