Ruby on Rails web-application that leverages libvips image processing library and Leaflet interactive maps library to apply Vegetation Indices (VIs) on map tiles.
The approach was taken after analyzing how DroneDeploy works with VIs.
It is being published as open source to demonstrate how WebODM contributors can apply VIs on-the-fly on map tiles. This approach avoids the need to store different tiles for each VI.
It is generated a thumbnail of the full orthophoto. Then it is applied each one of the implemented indices on the thumbnail and is saved a histogram of each index result.
The histogram is then used to calculate a min
and max
used to "clip" results bellow/above min/max on individual tiles.
- VARI
- GLI
- IOR
- NGRI
- NDVI
- BAI
- SAVI
- MNLI
- MSR
- RDVI
- TDVI
- OSAVI
- LAI
app/controllers/vegetation_index_controller.rb
Please follow through this file: app/lib/vegetation_index.rb and below explanation →
The method generate_orthophoto_statistics
does generate a reduced dimension version of the full orthophoto because it is more efficient computationally to proceed with it reduced.
It then calls run_and_store_indices_statistics
that will call index_statistics
for each Vegetation Index that we want to use.
index_statistics
does apply a specified Vegetation Index to the reduced orthophoto and returns it's "min" and "max" values along with their "histogram with 256 bins".
Now you can call apply_index
for each tile generated from the full dimension orthophoto sending the "min"/"max" calculated by index_statistics
. Or even better, you can use findClippedMinMax() JavaScript method to increase the contrast by ignoring "the first and last 3% histogram values" and calculating a better "min"/"max" (clipped_min/clipped_max) to use in apply_index
.