Whilst looking for the best available open source solution to generate terrain heightmaps from satellite stereo pairs, I stumbled upon the results of an international IARPA ‘Multiple view Stereo 3D Mapping challenge‘. The entries that secured 2nd and 3rd place used variation’s of Ames Stereo Pipeine (ASP) NASA’s automated, open-source pipeline for mass production of digital elevation models (DEMs) from very high-resolution commercial stereo satellite imagery. I couldn’t wait to dig deeper and review it’s capabilities. I started by setting up a QGIS project file which allowed me to load up my results from numerous test runs covering every key permutation available for the 2 most successful algorithms, this enabled quick comparison of sometimes subtle differences in results:
SGM (Semi-Global Matching) – a proven stereo algorithm with widesread popularity.
MGM (More Global Matching) – is a variation of SGM that can produce superior output at the cost of longer run-time and higher memory usage.
I added a red background on every resulting raster to highlight area’s where the algorithm had not been able to process. Click below image to see animated testing:
Using Blender (2.90) I created a node group that can add procedural snow to any imported terrain. The node group can be applied with only a few adjustments required to each new environment. This can be controlled on X,Y and Z axis, this is particularly important for the Z axis in order to keep the snow off of the sea.
Armory3d is a completely open source game engine that is fully integrated into Blender. Below is my first attempt at stitching a terrain mesh, layered with satellite/flown imagery, making use of the excellent BlenderGIS plugin. You can then simply export the project to an HTML5 application which can run on any browser.
See below a second attempt with some slightly higher resolution sat data, with some improvements to control methods (detailed below). Use WASD keys & left mouse button for controlling camera, sun direction and shadows can also be adjusted with keys – T,Y,G,H,B,N:
Having discovered Orfeo ToolBox and it’s very handy QGIS plugin, I set about reviewing each of OTB’s supervised classifiers, to see which one performs the best with the goal of generating a perfect surface mask that I can use in my terrain project within RV4 engine.
Example showing source raster + libsvm_linear classifier:
Whilst working out how to manage heightmap and satellite imagery within QGIS in preparation for loading into RV4 Engine, I discovered some interesting things along the way.
The first major issue reared it’s head following a GDAL update affecting the gdalwarp command, which broke a step I had been relying on – ‘Clip to raster by mask layer‘ I asked the question on gdal’s github page, and it was confirmed that I had to switch to use full extents, instead of the easier shapefile mask layer. See below original pipeline which mainly relied upon QGIS GUI config.
This lead me to invest more time learning the construct of the GDAL commands within QGIS’s python console. There is of course a lot more flexibility within command line than using the GUI.