CropSense is a free, open-source QGIS plugin for calculating vegetation indices from UAV/drone multispectral imagery. Designed for precision agriculture researchers, agronomists, and crop scientists, it automates the entire workflow — from scanning date-wise image folders to computing 22+ indices and saving analysis-ready GeoTIFFs — in a single, easy-to-use interface.
Built for studies involving nitrogen management, crop health monitoring, and multi-temporal field analysis.
- Features
- Screenshots
- Supported Vegetation Indices
- Installation
- Folder Structure
- How to Use
- Custom Index Builder
- Output Structure
- Band Auto-Detection
- Requirements
- Contributing
- Citation
- License
- 22+ built-in vegetation indices — covering nitrogen, biomass, chlorophyll, soil adjustment, water stress, and LAI
- Custom index formula builder — write your own indices using band names and numpy functions, with live validation
- Dropdown formula builder — compose formulas visually by clicking band and operator buttons
- Multi-TIF support — handles multiple stacked GeoTIFFs per date folder (different sensors or flights)
- Automatic band detection — reads wavelength tags, band descriptions, and Pix4D/Metashape metadata to assign bands; falls back to positional order
- Manual band override — correct any wrong assignment through the Band Inspector table
- Batch processing — processes all date folders in one run; outputs organised by date and sensor
- Selective processing — enable or disable individual TIF files from the tree view before running
- Auto-load into QGIS — optionally adds all output layers directly to the QGIS Layers panel
- Live progress log — real-time feedback with mean and std values per index per date
- Thread-safe — scanning and processing run in background threads; UI stays responsive
- Zero-safe division — all formulas use safe division to prevent NaN/inf artefacts
- LZW-compressed output — compact float32 GeoTIFFs with full CRS and geotransform preserved
| Tab | Description |
|---|---|
| 📁 Data Input | Scan folders, view detected TIFs in a tree, enable/disable each |
| 🔬 Band Inspector | Review and override auto-detected band assignments per TIF |
| 📊 Index Selection | 22 built-in indices grouped by category with quick-select buttons |
| 🧮 Custom Builder | Dropdown + text formula builder with live validation |
| 💾 Output & Run | Set output folder, options, run preview, and launch |
| 📋 Log | Real-time progress, mean/std results, error messages |
| Index | Formula | Use Case |
|---|---|---|
| NDRE | (NIR − RE) / (NIR + RE) | Best overall N-nutrition indicator (LNC, LNA, PNC, PNA) |
| GNDVI | (NIR − G) / (NIR + G) | Chlorophyll & N uptake; saturates later than NDVI |
| MCARI | [(RE−R) − 0.2(RE−G)] × (RE/R) | Highest SPAD correlation in rice canopy (R=0.91) |
| LCI | (NIR − RE) / (NIR + R) | Leaf chlorophyll index at full canopy |
| CVI | NIR × R / G² | Leaf chlorophyll concentration |
| RENDVI | (RE − R) / (RE + R) | Stress detection in dense canopy |
| Index | Formula | Use Case |
|---|---|---|
| NDVI | (NIR − R) / (NIR + R) | Biomass & overall vigour baseline |
| RVI | NIR / R | Simple ratio biomass indicator |
| DVI | NIR − R | Linear biomass sensitivity |
| IPVI | NIR / (NIR + R) | Always-positive NDVI form |
| BNDVI | (NIR − B) / (NIR + B) | Low soil background noise |
| WDRVI | (0.1×NIR − R) / (0.1×NIR + R) | Reduces NDVI saturation at high LAI |
| Index | Formula | Use Case |
|---|---|---|
| EVI | 2.5 × (NIR−R) / (NIR + 6R − 7.5B + 1) | Soil & atmosphere corrected |
| EVI2 | 2.5 × (NIR−R) / (NIR + 2.4R + 1) | Two-band EVI, no blue required |
| ARVI | (NIR−(2R−B)) / (NIR+(2R−B)) | Aerosol-resistant |
| SIPI | (NIR − B) / (NIR − R) | Carotenoid to chlorophyll ratio |
| Index | Formula | Use Case |
|---|---|---|
| SAVI | 1.5 × (NIR−R) / (NIR + R + 0.5) | Early season / sparse canopy |
| OSAVI | (NIR−R) / (NIR + R + 0.16) | No manual L parameter needed |
| MSAVI | [2NIR+1 − √((2NIR+1)²−8(NIR−R))] / 2 | Auto soil correction |
| Index | Formula | Use Case |
|---|---|---|
| NDWI | (G − NIR) / (G + NIR) | Open water detection |
| NDMI | (NIR−G) / (NIR+G+RE) | Plant water stress (5-band proxy) |
| Index | Formula | Use Case |
|---|---|---|
| LAI_NDVI | 3.618 × NDVI − 0.118 | Leaf Area Index empirical proxy |
- Download
CropSensefrom the Releases page - Open QGIS
- Go to Plugins → Manage and Install Plugins → Install from ZIP
- Select the downloaded ZIP → click Install Plugin
- The plugin appears under Raster → Multispectral VI Calculator → VI Calculator
Copy the CropSense/ folder into your QGIS plugins directory:
| Operating System | Plugin Directory |
|---|---|
| Windows | %APPDATA%\QGIS\QGIS3\profiles\default\python\plugins\ |
| macOS | ~/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/ |
| Linux | ~/.local/share/QGIS/QGIS3/profiles/default/python/plugins/ |
Then enable it in Plugins → Manage and Install Plugins → Installed.
Tip for Windows users: Press
Win + R, type%APPDATA%, press Enter, then navigate toQGIS\QGIS3\profiles\default\python\plugins\.
CropSense expects your data to be organised in date-wise sub-folders, each containing one or more stacked multispectral GeoTIFFs:
DataRoot/ ← Select this as your root folder
08-26/
orthomosaic.tif ← Stacked 5-band GeoTIFF (sensor A)
reflectance.tif ← Optional second TIF (sensor B)
09-10/
orthomosaic.tif
09-25/
orthomosaic.tif
10-08/
orthomosaic.tif
Each folder should contain 5 bands: Blue, Green, Red, Red Edge, NIR (standard for DJI Phantom 4 Multispectral, MicaSense RedEdge, Parrot Sequoia).
4-band sensors (no Red Edge) are also supported — indices requiring Red Edge will simply be skipped for those files.
- Open the plugin from Raster → Multispectral VI Calculator → VI Calculator
- In Tab 1 (Data Input), click Browse and select your root data folder
- Click Scan Folder
- The plugin displays all detected date folders and TIF files in a tree view
- Tick or untick the checkbox next to each TIF to include or exclude it from the run
- Click any TIF row in the tree to open the Band Inspector (Tab 2)
- Review how each raster band was identified (wavelength tag, description, or positional)
- Use the Override dropdown to correct any wrong assignment
- Click Apply Overrides to save changes
- Go to Tab 3 (Indices)
- Check the indices you want to calculate
- Use quick-select buttons: All / None / Nitrogen / Greenness / Canopy / Soil / Water
- Go to Tab 4 (Custom Builder)
- Use Option A (dropdown builder) to compose a formula by clicking buttons
- Or use Option B (text box) to type a formula directly
- Click Validate to test the formula, then Add to Run List
- Go to Tab 5 (Output & Run)
- Click Browse to select your output folder
- Toggle options: auto-load into QGIS, overwrite existing files
- Click Refresh Preview to confirm what will be calculated
- Click ▶ Run VI Calculation
- Go to Tab 6 (Log) to see live progress
- After completion, mean and standard deviation per index per date are shown
- All output GeoTIFFs are saved and (optionally) loaded into QGIS automatically
Write any vegetation index using standard band names:
BLUE GREEN RED REDEDGE NIR
safe_div(numerator, denominator) # Zero-safe division (recommended for all ratios)
np.sqrt() np.clip() np.log()
np.exp() np.abs() np.maximum() np.minimum()# NDVI
safe_div(NIR - RED, NIR + RED)
# EVI
2.5 * safe_div(NIR - RED, NIR + 6 * RED - 7.5 * BLUE + 1)
# Custom chlorophyll index
safe_div(REDEDGE - RED, REDEDGE + RED + GREEN)
# Clip result to a range
np.clip(3.618 * safe_div(NIR - RED, NIR + RED) - 0.118, 0.0, 10.0)Results/ ← Your chosen output folder
08-26/
orthomosaic/
08-26_orthomosaic_NDRE.tif
08-26_orthomosaic_GNDVI.tif
08-26_orthomosaic_NDVI.tif
08-26_orthomosaic_MCARI.tif
08-26_orthomosaic_EVI.tif
...
reflectance/
08-26_reflectance_NDRE.tif
...
09-10/
orthomosaic/
09-10_orthomosaic_NDRE.tif
...
All outputs are float32 GeoTIFFs with:
- Full CRS and geotransform from the source image
- LZW compression
- NaN as NoData value
- Values clipped to [-1, 1] for normalised indices
CropSense automatically identifies which raster band corresponds to which spectral channel using a four-tier priority system:
| Priority | Method | Example |
|---|---|---|
| 1 | Wavelength tags in rasterio metadata | wavelength = 560 → GREEN |
| 2 | Band description strings | "Red Edge" → REDEDGE |
| 3 | Pix4D / Metashape / DJI band name tags | BandName = NIR → NIR |
| 4 | Positional fallback | Band 4 → REDEDGE (standard order) |
If auto-detection is wrong, you can manually override any band assignment in the Band Inspector tab without re-scanning.
| Dependency | Version | Notes |
|---|---|---|
| QGIS | ≥ 3.16 | Tested on 3.22, 3.28, 3.34, 3.38 |
| Python | ≥ 3.9 | Bundled with QGIS |
| numpy | ≥ 1.20 | Bundled with QGIS |
| rasterio | ≥ 1.3 | Install separately if needed |
If QGIS cannot find rasterio, install it through the OSGeo4W Shell (Windows):
pip install rasterioOn macOS/Linux:
pip3 install rasterio --break-system-packagesContributions are welcome. To contribute:
- Fork the repository
- Create a feature branch:
git checkout -b feature/my-new-index - Make your changes and test in QGIS
- Run the syntax check:
python3 -m pyflakes *.py - Submit a Pull Request with a clear description
- Additional vegetation indices
- Support for hyperspectral sensors (>5 bands)
- Field boundary drawing tool (Phase 2)
- Per-plot value extraction and CSV export (Phase 2)
- Time-series plotting of VI values across dates
- Integration with QGIS Processing framework
If you use CropSense in your research, please cite it as:
@software{cropsense2025,
title = {CropSense: Multispectral Vegetation Index Calculator for QGIS},
author = {Map Mentors (Lalit BC)},
year = {2025},
version = {1.0.0},
url = {https://github.com/Lalitgis/cropsense},
note = {QGIS Plugin for UAV multispectral image analysis}
}- Rouse et al. (1974) — NDVI
- Gitelson & Merzlyak (1996) — GNDVI
- Barnes et al. (2000) — NDRE
- Daughtry et al. (2000) — MCARI
- Huete et al. (2002) — EVI
- Rondeaux et al. (1996) — OSAVI
- 22 built-in vegetation indices
- Custom formula builder (text + dropdown)
- Multi-TIF per date folder support
- Automatic band detection from metadata
- Manual band override interface
- Batch processing with progress log
- Field boundary drawing tool
- Per-plot value extraction
- Smart CSV exporter (mean/std/min/max per plot per VI per date)
- Time-series VI trend plots
- QGIS Processing provider integration
- Hyperspectral sensor support
CropSense is released under the GNU General Public License v3.0. See LICENSE for full terms.
Made for precision agriculture research | Built with QGIS & Python
