This takes in an image of non-overlapping coins and return the exact change all the coins equal to. I implmented the coin mask extraction using OpenCV in C++.

Methodology

  • HSV was used instead of RGB to identify the copper and silver colored objects due to RBG channels picking up color distortions by the reflections of the metal.
  • I set up contours and draw circle for all of them. But since a lot more contours were picked up than the coin circles, with many false detections being clusters of sparse contours…
  • I took average of all contour sizes, and only used the contours that had an area greater than or equal to 7% of the average.

Results

All the coin masks were perfectly extracted. Then by looking at the coin sizes relative to each other, we were able to achieve 70%+ accuracy rate in calculating all the coin values.