I have an image of a cross-section of soil where the main object of interest are the plant roots.
I would like to segment or extract the roots from the background noise of the soil itself and other obstructions such as spider webs. The goal is to form a clean image of the root network or end up with a result similar to what is shown in StackOverflow - Detect the vein pattern in leaves. In some cases, cracks in the soil itself are detected as interesting lines (structural artifacts) which is an unwanted result.
It seems I may have to apply a series of filters, does anyone have a suggestion what I could do to clean such image(s) or a pre-processing approach that would provide better results.
Desaturate the image using any method your prefer (either a color register, luminance or lightness). It is much easier to perform the next steps if the image is only 1 dimensional
possibly apply some non-linear function over the pixels gray value. This might increase the visual color difference between light pixels and dark pixels. Additionally, it will reduce the color difference between dark pixels and very light pixels. you could consider it as a smooth threshold function.
As the roots have a light color and the ground is overall dark, we should look for 2 aspects: a pixel with a light value and to which the neighboring pixels have a dark value. To enhance this second aspect, you could add a Laplace-edge detect filter to the image (so the resulting value will be the current value and the value of the laplace filter).
At this point, if properly done, the roots should already somewhat pop out the image. One could follow this up with some Dilate - Erode filters (you can stack those) to even out background color differences.