Following in the footsteps of this blog post: http://blog.wolfram.com/2011/09/09/building-a-microscopy-application-in-mathematica/, I took a microscope picture of some particles on a surface, and attempted to write a script to identify and count them automatically. However, I've been having a difficult time seperating closely spaced particles, and the MaxDetect method in the blog post seems to not work too well on this data set.
Why I find this failure surprising: Picking out the dark spots by hand is fairly trivial, and I imagine that if one were to 3D print a surface where darker pixel values represent depressions, the problem could be solved by rolling some marbles around and seeing where they stick.
Here's the picture / data:
The first thing I did was then to binarize (with the Kittler-Illingworth minimum error thresholding method) and color negate the data using the command:
ColorNegate[Binarize[image, Method -> "MinimumError"]]
I then attempted to apply ImageAdjust[DistanceTransform[...]] to the image, yielding:
Which I then applied MaxDetect to, yielding:
So, interestingly, there seems to be a ring of local maxima around each particle. Even if you use Erosion extensively, there still seem to be significant clusters of local maxima corresponding to each particle. As such, I've been having a very difficult time using the MaxDetect method in the aforementioned blog post to individually identify and count each particle.
Let's say that the precise centroid coordinates of each particle are not important to know exactly. Is there a "nice" method of assigning a distinct morphological component or coordinate to each particle without a lot of hands-on tuning? Where perhaps we can end up with something like this (where I've hand-identified particles)?