DSMMERGE is a great function that allows users to generate significantly better Digital Surface Models (DSMs) by merging a set of geocoded DSMs from a stereo airphoto or satellite project into a single multiview DSM. The final DSMMERGE result is typically of higher quality compared to a single DSM since each geocoded DSM has a different viewing geometry. Also, occlusions in one DSM can be filled in from a different DSM. To achieve the best possible result when working with aerial images, we recommend an overlap of 80/60 as well as good aerotriangulation between images.
More information on the DSMMERGE algorithm and workflow is found in the CATALYST Professional Help documentation. Tutorials for working in Python are found on our Python Cookbook. Other DSM merging methods are available, but are used in slightly different circumstances. SGMMERGE is intended to merge Forward/Nadir (F/N) and Backward/Nadir (B/N) pairs of images in the nadir epipolar space, followed by geocoding via GEOCODEDEM.
The following example shows how to run the DSMMERGE algorithm in Python. This script requires a set of overlapping geocoded DSMs created from an airphoto project. All files must have the same projection and resolution. In each file, band 1 contains the DSM, bands 2,3,4 contain RGB imagery, and band 5 contains the score channel. Since the DSMs produced do not perfectly align vertically due to small errors in the exterior orientation, a larger blend width of 100 is used (instead of the default of 48), and the error tolerance is set to 10 (instead of the default of 4).
# Import the dsmmerge algorithm from the CATALYST python library
from pci.dsmmerge import dsmmerge
# List of geocoded DSM files, typically produced by GEOCODEDEM as part of a DSM extraction process.
# All files must have the same projection, resolution and band sequence.
mfile = r"I:\Tutorials\DSMMERGE\*.pix"
# Specifies the input band (channel) that contains the digital elevation model to be used.
dbec = [1]
# Input score channel. This information is very important as the software uses the input score channel for elevation selection.
# Typcially this is a mask that shows valid DSM values, failed DSM locations, and No Data pixels.
dbscore = [5]
# Optionally specifies the imagery channels that should be merged to create a rough image overlay to the DSM.
# These are assumed to be bands already in each geocoded DSM file.
dbimage = [2,3,4]
# The name of the output file. A file with the same name must not exist in the output folder.
filo = r"I:\Tutorials\DSMMERGE\merged_dsm.pix"
# Edgefix specifies the size of the filter used to clean up building and tree edges.
# If unspecified then a value of 13 is used. Specifying a value of 0 switches off this option.
edgefix = [9]
# The level of filtering to apply to the generated DSM.
demfilt = "medium"
# Demopts specifies special processing options. The options include speckle, blend and maxerror.
demopts = "blend=100 maxerror=10"
dsmmerge(mfile, dbec, dbscore, dbimage, filo, edgefix, demfilt, demopts)
The results of the final merged DSM are seen below. The first image shows the original DSM, while the second image shows the merged DSM. You will notice that the final merged DSM produced a much clearer, less blurry result.
Before:
After:
The benefit of running DSMMERGE on your DSM files is that the resulting image is a higher quality result compared to a single DSM. The output will not require as much manual editing afterwards, as occlusions are filled in by overlapping DSMs. The final merged DSM can then be used as an input for a True Orthorectification workflow.