counts the value of coins in the image