Auto thresholding greyscale particle images

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Auto thresholding greyscale particle images

Alistair
Ladies and gents!

I have batches of greyscale FEGSEM images of a metal matrix with particles imbedded which we want to get a size/distribution stats analysis from. Previously, we have had to manually threshold iamges block-by-block which would take at least 20mins each, but with potentially 1000 images incoming, I am developing a macro to automatically batch process this.

Effectively, it crops, converts to 8-bit, then runs a background subtract, auto brightness/contrast, finally a threshold/binary. I have nearly got it sussed, but it struggles to differentiate between grains/particles or picks up too much noise.

I have only started using any image processing, let alone imageJ (Fiji), last week.

Below is an example image we collect, and a copy of the macro code i am using, and the result. If anyone is able to have a look, advise any adjustments or possible alternative solutions, i would extremely greatful!




run("8-bit");
run("Duplicate...", "title=*.jpg");
makeRectangle(0, 0, 1024, 687);
run("Crop");
run("Subtract Background...", "rolling=20 light");
run("Enhance Contrast...", "saturated=0.15 equalize");
setAutoThreshold("RenyiEntropy");
//run("Threshold...");
setThreshold(0, 60);
run("Convert to Mask");
run("Auto Threshold", "method=Default white");