My colleague asked me to help him out with this image:
He needs to know the grain size distribution, and they’ve been having trouble automating this. He knew I’d been doing some work with Mathematica’s image analysis capabilities so he thought maybe I could make some headway. This post shows my current progress.
My first idea was do use EdgeDetect to find the boundaries:
This seems to isolate most of the grains, but I need Mathematica to isolate the areas that the edges separate. What I decided to do was to darken up the edges by dilating them and subtracting them from the original image:
Now I use the very cool MorphologicalComponents command to get this:
Here’s an animation that slowly identifies the grains:
Cool, huh? I thought so. I’m waiting to hear from my colleague to see if this is the sort of identification he needs. My guess is that he wants something like a histogram of the areas of the grains. With ComponentMeasurements, that’s super easy:
Ok, so now I admit to you my ignorance. I have no idea how people do this, though I did find this standard (paywall) at the American Society for Testing and Materials (ASTM). I’m hoping some of you can help me out with refining this technique. It’s really fast in Mathematica to run it, and I think it’s pretty robust, but it does clearly miss a few grains and inadvertently joins a few.
Thoughts? Here are some starters:
- This is cool, but I’d love to know the exact Mathematica commands.
- This is dumb, there’s a much better way to do it, and here’s how . . .
- This is cool, can I send you all my data so that I can graduate sooner?
- This is dumb, we pay grad students to do this by hand so that they learn to hate. Don’t make this available.
- This is cool, but I bet it would struggle with . . .
- This is dumb, it only worked this time because . . .