Search code examples
imageimage-processingfilterthreshold

Detect the vein pattern in leaves?


My aim is to detect the vein pattern in leaves which characterize various species of plants

I have already done the following:

Original image:

enter image description here

After Adaptive thresholding:

enter image description here

However the veins aren't that clear and get distorted , Is there any way i could get a better output

EDIT:

I tried color thresholding my results are still unsatisfactory i get the following image

enter image description here

Please help


Solution

  • The fact that its a JPEG image is going to give the "block" artifacts, which in the example you posted causes most square areas around the veins to have lots of noise, so ideally work on an image that's not been through lossy compression. If that's not possible then try filtering the image to remove some of the noise.

    The veins you are wanting to extract have a different colour from the background, leaf and shadow so some sort of colour based threshold might be a good idea. There was a recent S.O. question with some code that might help here. After that some sort of adaptive normalisation would help increase the contrast before you threshold it.

    [edit]
    Maybe thresholding isn't an intermediate step that you want to do. I made the following by filtering to remove jpeg artifacts, doing some CMYK channel math (more cyan and black) then applying adaptive equalisation. I'm pretty sure you could then go on to produce (subpixel maybe) edge points using image gradients and non-maxima supression, and maybe use the brightness at each point and the properties of the vein structure (mostly joining at a tangent) to join the points into lines.

    Example of processed leaf image