Detects and marks green plants in a (not green) soil area image using Python OpenCV.
The goal is to mark unwanted volunteer plants for removal.
For an overview of the image processing performed, see the wiki.
pip install -r requirements.txt
see Contributing for more installation options
Using the sample soil image, soil_image.jpg
.
Run the script: python -m plant_detection.PlantDetection
View soil_image_marked.jpg
from plant_detection.PlantDetection import PlantDetection
help(PlantDetection)
PD = PlantDetection(image='plant_detection/soil_image.jpg')
PD.detect_plants()
PD = PlantDetection(image='plant_detection/soil_image.jpg', morph=15, iterations=2, debug=True)
PD.detect_plants()
python -m plant_detection.PlantDetection --GUI
Default image to process is soil_image.jpg
. To process other images, use:
python -m plant_detection.PlantDetection --GUI other_image_name.png
For example: test_image.jpg
python -m plant_detection.PlantDetection --GUI test_image.jpg
This will create a plant detection parameters input file from the slider values.
python -m plant_detection.PlantDetection test_image.jpg
Or, for more options, enter a python command line:
python
from plant_detection.PlantDetection import PlantDetection PD = PlantDetection(image='test_image.jpg', from_file=True) PD.detect_plants()
(For examples of output for graphic-related keyword arguments, see the wiki)
Annotated image: test_image_marked.png
python -c 'from plant_detection.PlantDetection import PlantDetection; help(PlantDetection)'
python -m plant_detection.PlantDetection --GUI plant_detection/p2c_test_color.jpg
plant-detection
├── plant_detection - Plant Detection Package
│ ├── tests - project test suite
│ ├── PlantDetection.py - calibrate and detect plants
│ ├── Capture.py - take photos with a camera
│ ├── Parameters.py - handle input parameters
│ ├── Image.py - image processing
│ ├── DB.py - handle plant data
│ ├── P2C.py - pixel to coordinate conversion
│ ├── PatternCalibration.py - alternative calibration method
│ ├── CeleryPy.py - convert plant data to CeleryScript
│ ├── Log.py - custom send_message wrapper
│ ├── ENV.py - environment variable save and load operations
│ ├── GUI.py - interactively change input parameters
│ ├── p2c_test_calibration.jpg - coordinate conversion calibration test image
│ ├── p2c_test_objects.jpg - coordinate conversion detection test image
│ ├── p2c_test_color.jpg - color range test image
│ └── soil_image.jpg - plant detection test image
├── quickscripts - scripts to run specific tasks
└── README.md