This project provides a Python toolset to stack multispectral bands from drone imagery and create Cloud Optimized GeoTIFF (COG) outputs, with the ability to spatially merge captures or save them as individual multi-band TIF files.
drone_wheat_processing/
├── src/ # Source code scripts
│ ├── drone_stitcher.py # Spatially mosaic and stack georeferenced images
│ └── batch_processor.py # Process individual captures into multi-band stacks
├── data/ # (Git Ignored) Store raw images & outputs here
│ ├── input/ # Place raw drone imagery (e.g., DJI folders) here
│ └── output/ # Processed outputs will be saved here
├── requirements.txt # Project dependencies
├── .gitignore # Ignores data/, environments, and temp files
└── README.md # Project documentation
If you haven't created the virtual environment yet:
python3 -m venv drone_envsource drone_env/bin/activatepip install -r requirements.txtPlace your raw imagery in the data/input/ folder (or a subfolder inside it). The tools are located in the src/ directory.
The batch_processor.py script imports the grouping logic to process each image capture group (e.g., 0001, 0002, 0003) into its own individual 4-band output file. This bypasses the spatial mosaic step which would fail on raw drone imagery missing CRS data.
python src/batch_processor.py <input_directory> <output_directory>Example:
python src/batch_processor.py data/input/droneImagery/ data/output/processed_output/The drone_stitcher.py script stacks the bands and attempts to spatially merge all capture groups into a single file. Note: The spatial merge requires images to be already georeferenced/processed into orthophotos.
python src/drone_stitcher.py <input_directory> <output_filename>Example:
python src/drone_stitcher.py data/input/droneImagery/ data/output/output_mosaic.tif--cog: (Default: True) Export as a Cloud Optimized GeoTIFF.- Use
--cog Falseif you prefer a standard GeoTIFF.
- Band Order: The output stack uses the order:
Band 1: Green,Band 2: Red,Band 3: Red Edge,Band 4: NIR. The band descriptions are natively embedded as metadata in the resulting TIFs. - Georeferencing: The spatial merge step requires georeferenced TIF files. If files lack CRS metadata (as seen in some raw DJI captures), the
drone_stitcher.pyscript will process individual stacks but skip the spatial mosaic step. If you are processing raw flight paths, rely on thebatch_processor.pyscript.