counting change


As an in-class exercise for Spatial Media we were asked to develop a program which would identify coins in a series of supplied images and tally up their total value. In one hour.

Since time was limited, I decided to use pixel count as a rough estimate of each coin’s size. This works very reliably with the sample set of images, but that’s likely because the images consist of duplicated coins and are on a solid white background. Several additional methods wold likely need to be implemented to deal with actual situations. (Code below)

Nevertheless, simple thresholding isolates the coins from the background and a seed fill algorithm identifies separate objects. The size of each found object is compared against calibrated values and the coin’s identity/value is inferred from that.

It was a fun (for me) challenge to develop the program in a limited time. I did spend some time after class cleaning up the display and implementing an interactive method to change the image for analysis.

Code (oF xcode project):






Leave a Reply