A leaf segmentation algorithm written in Python3 using OpenCV. In order to segment leaves from background, Otsu's threshold algorithm was used. To improve Otsu's performance both pre-processing and post porcessing operations were also used.
- Git
- Python3
- Numpy
- OpenCV
- Scipy
- Install requirements
For Debian/Ubuntu
sudo apt install python3-opencv python3-scipy python3-numpy git
For Fedora
sudo dnf install python3-opencv python3-scipy python3-numpy git
- Clone this repo
git clone https://github.com/oguztoraman/leaf-segmentation
- Run test.py
cd leaf-segmentation && python3 test.py
- GPLv3. See the COPYING file for details.
stackoverflow segmentation problem
===================================
RGB image
Resulted image
Segmented image
Success rate: % 91.900634765625
Elapsed time: 0.2488720417022705 s
===================================
Average success rate: % 91.900634765625
Average elapsed time: 0.2488720417022705 s