| Environments | PYTHON :: EASI |
| Quick links | Description :: Parameters :: Parameter descriptions :: Return Value :: Details :: Example :: Related |
| Back to top |
| Back to top |
dsmmerge(mfile, dbec, dbscore, dbimage, filo, edgefix, demfilt, demopts)
| Name | Type | Caption | Length | Value range |
|---|---|---|---|---|
| MFILE * | str | List of geocoded DSM files to merge | 1 - | |
| DBEC * | List[int] | Input DSM (elevation) channel | 1 - 1 | |
| DBSCORE | List[int] | Input score channel | 0 - 1 | |
| DBIMAGE | List[int] | Input Image channels | 0 - 8 | |
| FILO * | str | File name of output DSM | 1 - | |
| EDGEFIX | List[int] | Edge Fixing Filter Sizes | 0 - 16 | |
| DEMFILT | str | Filter level | 0 - | |
| DEMOPTS | str | Merging options | 0 - |
| Back to top |
MFILE
List of geocoded DSM files, typically produced by GEOCODEDEM as part of a DSM extraction process from stereo imagery. This can be a directory, a directory with wild card or a list of file names held in a text file (.txt extension). All files must have the same projection, resolution and band sequence.
DBEC
Specifies the input band (channel) that contains the digital elevation model (DSM or DEM) to be used.
DBSCORE
Optionally specifies the channel that contains score information. Typcially this is a mask that shows valid DSM values, failed DSM locations, and No Data pixels.
If a negative value is specified then this indicates a (postive) score band exists and should be used however it should not be written to the output file.
NOTE: If a score band is available the resulting merged DSM is typically of higher quality.
DBIMAGE
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.
FILO
The name of the output file. A file with the same name must not exist in the output folder. The file will be created with the same projection and resolution as using the first file specified in MFILE. The first output band will be the DSM followed by imagery (if specified) and the score (if specified) in the last band.
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.
DEMFILT
The level of filtering to apply to the generated DSM. The process applies successive noise, median, and smoothing filters.
DEMOPTS
Specifies special processing options. Typically, you need not specify a value for this parameter.
| Back to top |
Returns: Number of images used.
Type: PCI_INT
The return value is the number of input images used to fill the output image.
| Back to top |
DSMMERGE merges a set of geocoded DSM's from a stereo airphoto or satellite project into a single DSM. The merged DSM is typically of higher quality since each geocoded DSM has a different viewing geometry and occlusion in one DSM can be filled in from a different DSM. In addition the multiple DSM elevations of the same ground pixel can be used to detect blunders and averaging multiple good elevations can increase vertical accuracy.
A score band (DBSCORE) can be specified (if available) to increase reliability of the merging process by specifying which DSM values are 'good' or 'failed'. Failed pixels are not used in the merged DSM. If a score band is not specified then an attempt is made to reject DSM values that do not match with the majority of the other DSM values at a particular location. A score value of 0 indicates a failed pixel, 255 indicates no data and values between 90 and 110 indicate a good pixel (100 default).
If imagery is available (DBIMAGE) this this will be merged together at the same time as the DSM values. The resulting image will be a 'crude' true-orthorectification (aka DSM ortho) product however it is not colour balanced by default and will contain many rough building edges. This imagery is intended to provide guidance in further DSM editing or a rough pre-view of the higher quality product that can be generated using the TORTHO algorithm. The imagery can be colour balance by specifying the 'balance' option in the DEMOPTS parameter. If this option is specified a temporary working directory is created in the same directory as the output (FILO). This processing can take significant temporary disk space equivalent to two times the total disk space of the all the imagery bands. The final colour balancing is applied directly and permanently to the imagery in each input DSM file so should only be used once.
The EDGEFIX parameter attempts to straighten building edges in the DSM by applying a filter. Larger filter sizes will do a better job on long straight buidling edges but may have unintended consequences on buildings with curved or complex edges. While building edges are the intended target this filter will also affect trees and cliff edges. If the DSMs do not contain buildings smaller values (or switching this option off) is recommended. Values from 5 to 31 are supported and the default is 13. A value of 0 switches this option off.
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. MOSPREP and MOSRUN can take sets of geocoded DSMs but use a 'cookie-cutter' approach and does not compensate for occlusions and building leans etc...
The input files must contain the same number of channels, and have the same projection and resolution.
| Back to top |
You have a set of overlaping geocoded DSM's created from an airphoto project in (c:\\project\\*.pix. All files have the same projection and resolution. In each file band 1 contains the DSM, bands 2,3,4 contain RGB imagery and band 5 is the score band. Since the DSMs produce 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):
from pci.dsmmerge import dsmmerge mfile = "project/*.pix" dbec = [1] dbscore = [5] dbimage = [2,3,4] filo = "merged_dsm.pix" edgefix = [9] demfilt = "medium" demopts = "blend=100" dsmmerge(mfile, dbec, dbscore, dbimage, filo, edgefix, demfilt, demopts)
© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.