Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 723
vini Avatar asked Mar 08 '12 12:03

vini


2 Answers

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

like image 196
Peter Wishart Avatar answered Sep 24 '22 20:09

Peter Wishart


In the past I made good experiences with the Edge detecting algorithm difference of Gaussian. Which basically works like this: You blur the image twice with the gaussian blurr algorithm but with differenct blur radii. Then you calculate the difference between both images.

Pixel with same color beneath each other will creating a same blured color. Pixel with different colors beneath each other wil reate a gradient which is depending on the blur radius. For bigger radius the gradient will stretch more far. For smaller ones it wont.

So basically this is bandpass filter. If the selected radii are to small a vain vill create 2 "parallel" lines. But since the veins of leaves are small compared with the extends of the Image you mostly find radii, where a vein results in 1 line.

Here I added th processed picture. Steps I did on this picture:

  1. desaturate (grayscaled)
  2. difference of Gaussian. Here I blured the first Image with a radius of 10px and the second image with a radius of 2px. The result you can see below.

This is only a quickly created result. I would guess that by optimizing the parametes, you can even get better ones. enter image description here

like image 43
KarlKarlsom Avatar answered Sep 24 '22 20:09

KarlKarlsom