This project is made to count the number of eucalyptus trees in a given image.
To do it, basically the steps are:
- Read the image
- Convert it to HSV color space
- Get the intersection between upper and lower bounds mapped to trackbars
- Apply a Gaussian blur to the image
- Detect the contours of the image
- Draw the contours on the image
Doing it you will get the number of eucalyptus trees in the terminal.
The green contours are the ones that were detected as eucalyptus following the determined rules. The red contours are the ones that didn't follow the rules.
An example of the result is shown below:
To run the project, you need to have Python 3 installed on your machine. Then, you need to install the needed libraries. To do it, run the following command:
pip install -r requirements.txt
After that, you can run the project with the following command:
python src/trackbar_new.py
If you want to understand how the code works, you can check the trackbar_new.py file. But if you want to see a simpler version of color detection, you can check the highlight_color.py file.