Skip to content

Count the number of leaves present in an image using OpenCV-python.

Notifications You must be signed in to change notification settings

parvatijay2901/Count-leaves-in-an-image

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Count the number of leaves present in an image

In this project I have counted the number of leaves present in an Image. The whole project was done in Python programming language on Google Colab.

Throughout the project, I have used OpenCV's functions to do various tasks (ie, from reading the image, pre-processing it, drawing the contours to showing the final image).

Accuracy of detection depends on the image. You will have to change some values (ie, magnify the distance transform value, change the filter size etc. depending on the size of leaves present in the image).

Here are the outputs of some test images on which I had ran the algorithm:

Test case 1:

Test case 2:

Test case 3:

Test case 4:

Observations:

By observing the contours drawn on the leaves,

  • We will have to make some modifications to the values depending on the size of leaves present on the image.
  • Colour gradient changes in leaves can be an issue to detect the contours.
  • For slight overlapping of leaves, this algorithm works fine, but for large overlapping, this technique might not work as cv2.findContours() draw joint contours on overlapping objects.
  • In all other cases, the method works well when the image is placed on a less noisy background.

References:

Code References:

Image References:

About

Count the number of leaves present in an image using OpenCV-python.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published