How to count the number of coins in a image using erosion operator?
41 views (last 30 days)
in a image after using erosion operator on that image there will be number of coins placed randomly so now we have to find the total number of coins in that image. What are the steps to do this? can we do this by using the area of the coins?
Image Analyst on 19 Aug 2013
I have no idea why you're wanting to do it via morphology instead of with bwlabel() or regionprops() like most people would do it. But if you do you first need to threshold, then call bwulterode() to get a dot for each coin, then sum the image to count the dots. This is not an efficient way to count them, but it is a morphological way if you require that for some reason (like you want to show how slow and inefficient some methods can be).
binaryImage = coinsImage < 128; % or whatever.
dots = bwulterode(binaryImage);
numberOfCoins = sum(dots(:));