Detect vein pattern in leaves?

My goal is to determine the structure of the veins in the leaves that characterize different types of plants.

I have already done the following:

Original Image:

enter image description here

After the adaptive threshold:

enter image description here

However, the veins are not so clear and distorted, is there a way to get a better result

EDIT:

I tried the color threshold, my results are still unsatisfactory, I get the following image

enter image description here

Please, help

+6
source share
3 answers

The fact that his JPEG image will produce “blocking” artifacts, which in the example above cause most of the square areas around the veins to have a lot of noise, so it’s ideal to work with an image that did not have compression loss. If this is not possible, try filtering the image to remove some of the noise.

The veins you want to extract have a different color from the background, leaf, and shadow, so some threshold based on color might be a good idea. There was a recent S.O. question with some code that might help here . After that, some kind of adaptive normalization will help increase the contrast before you reach the threshold.

[edit]
Perhaps the threshold is not an intermediate step that you want to take. I did the following, filtering to remove jpeg artifacts, doing some CMYK math channel (bluer and blacker), then applying adaptive alignment. I’m sure that you could continue to produce (possibly sub-pixel) edge points using image gradients and suppress non-maximum numbers, and perhaps use the brightness at each point and the properties of the vein structure (mainly tangential joining) to attach the dots to the lines .

Example of processed leaf image

+5
source

In the past, I did a great job with the border detection algorithm, the difference is Gaussian . Which basically works as follows: You blur the image twice using the Gaussian blur algorithm , but with different blur. Then you calculate the difference between both images.

A pixel with the same color below each other will create the same color. A pixel with different colors below each other will have a gradient that depends on the blur radius. For a larger radius, the gradient will stretch more far. For smaller ones, this will not be.

So basically it is a band-pass filter. If the selected radii should be small, vanity creates 2 “parallel” lines. But since leaf veins are small compared to image extensions, you basically find the radii where the vein leads to 1 line.

Here I added the processed picture. The steps that I took in this picture:

  • desaturate (gray)
  • Gaussian difference. Here I blurred the first image with a radius of 10px and the second image with a radius of 2px. You can see the result below.

This is just a quickly generated result. I would suggest that by optimizing the parameters, you can even get the best. enter image description here

+4
source

It sounds like I'm back in college with neural networks. The neural network is a bit complicated, so I won’t go there. In any case, patterns are ideal candidates for 2D Fourier transforms! Here is a possible diagram:

  • You have training data and input.
  • Your data is presented as a 2D Fourier transform.
  • If your database is large, you must run PCA on the conversion results in order to convert the 2D spectrogram to a 1D spectrogram.
  • Compare the humming distance by checking the spectrum (after PCA) of 1 image with all the images in your dataset.

You should expect ~ 70% recognition with such primitive methods, as long as the images have approximately the same rotation. If the images do not have the same rotation, you may need to use SIFT. To get better recognition, you will need more intelligent training kits, such as a hidden Markov model or a neural network. The truth is, getting good results for this problem can be quite a lot of work.

Check out: https://theiszm.wordpress.com/2010/07/20/7-properties-of-the-2d-fourier-transform/

+1
source

Source: https://habr.com/ru/post/910240/


All Articles