Cleaning an image from "noise"

Hi there,
I work for a manufacturing industry producing cables. I have been using ImageJ to detect the wall thickness of a plastic extruded sample, as explained in this discussion. Basically, I take a picture from a microscope, I threshold it to get a binary image, then I apply a polar transformation to “unroll” the image and finally I use the plot profile to calculate the thickness. All these operations are done automatically by a macro.

I have now two problems related to some “noise” on the original image.

The first problem is related to the “frayed” edges of the sample. The sample is in plastic and is cut using a cutter, so the edges are non smooth. As you can see in the image below, there are some “threads” generated by the cut (circled in red). Those threads are still clearly visible in the thresholded image and for this reason the maximum thickness calculated is wrong. So, is there a way to “smooth” the edges of the image?

The second problem is related to some “holes” in the sample. Sometime, due to reflection, the sample has some areas clearer than others, as in the images below. Those clearer areas become “holes” in the thresholded image, thus causing the minimum thickness to be wrong. I would like that the “internal” part of the ring would be completely filled, is this possible?

Thanks for any suggestion.

Hi @gio

You can look into using some Binary Morphological operators… for example - perhaps adding a few erode or open calls into your macro - that should help smooth out those edges. Whatever you do - just make sure it’s applicable to multiple images and keep the steps the same for all of your images… to make sure it’s reproducible.

And for the other issue - you can use the binary call Fill Holes to fill in those “holes”. :slight_smile:

Try these out yourself… it should do the trick, but if you are still unsure what to do - you can attach a few original images here along with the macro you use - then we can better help you.

eta :slight_smile:

1 Like

Hi @etadobson,
thank you for your suggestions.

I am still experimenting, but it seems that the function that best suits my needs is the median filter.


And, of course, to fill holes there’s nothing better than the fill holes function :slight_smile:



Good day Gio,

apart from the fact that the best method is improving the cutting (most often post hoc image correction is much more costly than better object preparation and image acquisition), here is a result using contour tracing with a defined smoothing effect:

The underlying image is your sample “holes_threshold.png” (after filling the holes). Only an excerpt of its polar transform (without re-binarization) is shown. The contour traces in cyan allow the direct width measurement. The smoothing effect can be chosen as desired.

The drawback: The involved plugin is only commercially available.



1 Like