Wednesday, 27 May 2020

Generating NDVI Drone Panoramas in Python Code




 I share the development of a project that uses near infrared drone imaging to create NDVI panorama mosaics in Python with all coding available on the GitHub Repository here:
https://github.com/MuonRay/PythonNDVI/blob/master/PanoramaNDVIRawInput.py

Panorama Stitching, as used in aerial/satellite imaging and space exploration, uses a point matching algorithm (i.e. SIFT) on images taken from a camera then applies a homography transform creating a mosaic composite image. 

Here Using a 4K NIR Drone Camera we can create HDR NDVI Panoramas using DNG files for input (a JPEG Version is also available).  




We have talked about NDVI and how to generate standalone NDVI Drone images in previous articles such as here: http://muonray.blogspot.com/2019/07/ndvi-vegetation-mapping-project-with.html and here: http://muonray.blogspot.com/2019/10/specialist-ndvi-filter-developments-for.html

DNG is the RAW Format used in DJI's Mavic 2 Pro drone and is a data rich file format that requires Python's rawpy library to decode into a form that can be worked with using OpenCV for general image editing generally and panorama stitching specifically in Python.

It is hoped that this coding project will be a less computing intense solution to generating NDVI diagnostics of the environment without the need for expensive or computationally intensive processing such as creating 3D orthomosaics or photogrammetry files which can be relatively more daunting to produce and work with as compared to a panorama. 



Essentially any images acquired using a Near-Infrared (NIR) converted camera can be used to generate a modified Normalized Differential Vegetation Index (NDVI). The coding contains standalone colorbar legend and is a batch processing version that works with all DNG files in the working directory. ENDVI and SAVI Indexes also available and with greyscale options. in the larger Python NDVI GitHub project folder. I also encourage open modification and tinkering of this projects code for improving this field of exploration and environmental examination.


I have also included a selection of custom developed python codes for use in various drone imaging applications, such as batch conversion of DNG (RAW) drone images to JPEG or PNG, use of the rawpy library features of demosaicing, gamma factor correction and use of skimage library to demonstrate histogram equalization in colour images to create better contrast and depth. This repository also increases coding developed for use in generating panorama composite images both in JPG and DNG format, a very useful technique in high definition aerial imagery. These codes are open for use in educational and demonstration uses and for non-profit organisations.

See here:https://github.com/MuonRay/Drone-Image-Editing-in-Python-Coding-Repository