How to apply NDVI (Normalized Difference Vegetation Index) in NIR (near-infrared) orthophotos and VARI (Visible Atmospherically Resistant Index) in RGB orthophotos using libvips image processing library and their Python binding.
NDVI and VARI are simple graphical indicators that can be used to analyze remote sensing measurements, assessing whether or not the target being observed contains live green vegetation. It is applied using simple algebra with the bands and in each pixel of an input image.
The NDVI is calculated from these individual measurements as follows: NDVI = (NIR - Red) / (NIR + Red)
And VARI = (Green - Red) / (Green + Red - Blue)
libvips is a fast and open source image processing library.
Install libvips and Python. Then use PIP to install 'pyvips' and 'numpy' packages:
pip3 install pyvips
pip3 install numpy
OK? Run the program:
python3 pyvips-vari-ndvi.py nir.png NDVI
python3 pyvips-vari-ndvi.py rgb.png VARI
nir.png and rgb.png orthophoto thumbnails will be processed and resulting ndvi.png and vari.png will be saved.
OBS: The code was made to process images with "alpha" (transparency) layer/band. JPG? Export to PNG before.