4

I'm new in the Computer Vision. I would like to detect some kind of plants in a grass images.

Original Image Original Image

Canny Edge Detection Algorithmus Canny Edge Detection Algorithmus

Hough Line Transform (After Edge Detection) enter image description here

I have already tried:

  • to remove the grass in the background with comparing th average of white pixels in a a region.
  • line detection with the hough line transform algorithm (the grass adds wrong lines)

What's in your opinion the best approach to detect this plant?

james
  • 87
  • 8
  • Intreasting Task.. Show us some another images if avaibale – Humam Helfawi Feb 11 '16 at 17:01
  • I have added a image after hough line transform but I haven't any another original images at the moment. – james Feb 11 '16 at 17:12
  • Hougline could be a solution at all IMO. You do not even have lines – Humam Helfawi Feb 11 '16 at 17:14
  • I got like 90% of the plant. I used saturation and intensity images to create a mask. Plant saturation lower than grass saturation, but plant is brighter than background. So I multiplied both which increased contrast of plant to background. Then I got rid of the grass by some morphological operations and suppressing high frequencies – Piglet Feb 11 '16 at 17:49
  • @Piglet post an answer please, or this never happened :D – Miki Feb 11 '16 at 19:12
  • @Piglet: Could you explain a little bit detailed how you get rid of the grass? – james Feb 12 '16 at 12:28

3 Answers3

3

Dummy solution came in my mind. Since the grass is more detailed that the plant itself:

  1. Apply Canny or any other edge detector.
  2. Pass through the image using a window (let us say 10*10). For each window:
    • Compute the Density (number of white pixel if using Canny)
    • store it in array
  3. Threshold the values in the array using Otsu algorithm. The less values represent the windows that are part of the plant.
  4. Remap all needed window to the original picutre.
  5. if a window is computed as not part of the object but in the same time it is surrouned by windows of the object, it is part of it.
Humam Helfawi
  • 19,566
  • 15
  • 85
  • 160
  • 1
    A [normalized box filter](http://docs.opencv.org/2.4/doc/tutorials/imgproc/gausian_median_blur_bilateral_filter/gausian_median_blur_bilateral_filter.html#normalized-box-filter) should help with your second step. – beaker Feb 11 '16 at 17:40
3

Just for fun, and very similar to Humam's answer, just done using standard deviation instead of density, and making the image transparent where it doesn't think there are leaves. I used ImageMagick straight at the command line:

convert weed.jpg \( +clone -canny 0x1+10%+30% -statistic standarddeviation 10x10 -blur 0x8 -normalize -negate \) -compose copyopacity -composite result.png

enter image description here

Mark Setchell
  • 191,897
  • 31
  • 273
  • 432
  • Nice one.. I am eager to see more samples from the OP becauce I think those solution (including mine) will fail. I see it as one of the hardest CV problem ever. If the OP could make it. I think MIT gonna find him and hire him :D – Humam Helfawi Feb 11 '16 at 18:58
  • Clever solution. However this, as any other image processing approach, will most likely work on very specific images only, not in general. But, for the scope if this question, +1 :D. @HumamHelfawi Deep learning is doing tremendous improvements in object (including plants) recognition, and MIT already knows that :D – Miki Feb 11 '16 at 19:15
  • Hhhhhh I was about to say deep learning... but i was afraid to look like who wants a black box to do his own job :D – Humam Helfawi Feb 11 '16 at 19:17
  • 1
    I agree. Maybe some sort of texture analysis is needed. I know this method will fail for many other pictures - a general solution is very hard! – Mark Setchell Feb 11 '16 at 19:38
1

I implemented Humam's approach.

But added some Steps after the Otsu algorithm:

  1. Fulfill every black connected component
  2. extract the mask with a matrix subtraction
  3. Store the mask in a vector
  4. sort it by area size (= sum(mask))
  5. pick the biggest mask (=plant)
  6. on the plant mask: do Step 1 -3 again
  7. remove all small masks from the plant mask

I have some old and bad images from the plant, i'm going to test the algorithm the next days on these images. unfortunately it's winter in my country and the grass is covered with snow. so i have to wait a couple of weeks to make some proper image from this plant.

Result of extraction. enter image description here

The next step is to detect if the extracted image is the desired plant.

Humam Helfawi
  • 19,566
  • 15
  • 85
  • 160
james
  • 87
  • 8