I have an image of a cross-section of soil where the main object of interest are the plant roots. noisy_root_system

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.

Current results enter image description here


1 Answer 1


Maybe some of the following steps might help:

  1. 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
  2. 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.
  3. 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).
  4. 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.

Hope this helped a bit.

  • $\begingroup$ I'm trying to figure what these instructions mean practically in terms of code(cv2 or similar). For someone with no history with signal processing my aim is just trying to clean this for further processing. $\endgroup$
    – qboomerang
    Mar 1, 2021 at 9:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.