CS108 Project 3: Counting Dots

Due Monday, May 6, at 10:30 AM

Counting dots can be a time-consuming process, given a large enough number of dots. Oddly enough, this problem has applications in bioinformatics, for example, counting the number of neurons in the large image given with project 2. However, for this project, we will use synthetic data, generated using this program.
If the dots all had the same number of pixels, you could simply count the number of pixels that are dot colored, and divide by the number of pixels per dot. However, dots have a variable number of pixels, and so this simple strategy will not work. Instead, each pixel in a dot must be marked as "found" when that dot is counted. This can be accomplished by changing it to a different color using a flood fill.

Testing

The number of dots in the following image is 47. Your program should be able to figure out that number.

Demos

A demo of how to do a flood fill will be given in lab, and posted here when it is finished.
Tuesday Demo Code
Image we floodfilled on Tuesday
Thursday Demo Code
Image we floodfilled on Thursday

Here is a slow version of Tuesday's floodfill example. I don't recommend using anything in this for your project3, but if you would like to see the floodfill progress, it might be interesting:
Slow Floodfill

Deliverables

The source code should be given, along with a comment indicating the number of dots in the picture below: