| Environments | PYTHON :: EASI |
| Quick links | Description :: Parameters :: Parameter descriptions :: Details :: Examples :: Algorithm :: References :: Related |
| Back to top |
| Back to top |
epipolardsm (leftfile, rghtfile, extinter, filedem, demfilt, costfunc, penalty, segsize, demopts)
| Name | Type | Caption | Length | Value range |
|---|---|---|---|---|
| LEFTFILE * | str | Left input file name | 1 - | |
| RGHTFILE * | str | Right input file name | 1 - | |
| EXTINTER | List[int] | DEM-extraction interval | 0 - 1 | 1 - 32 Default: 1 |
| FILEDEM * | str | Output DSM file | 1 - | |
| DEMFILT | str | Filter level | 0 - | |
| COSTFUNC | str | SGM Cost Function | 0 - | 1 - 32 Default: MI |
| PENALTY | List[int] | SGM Penalty Values | 0 - 2 | 0 - 1000000 |
| SEGSIZE | List[int] | Threshold size for isolated segments to remove. | 0 - 1 | |
| DEMOPTS | str | Options list | 0 - |
| Back to top |
LEFTFILE
The file containing the left-epipolar image. The generated epipolar DSM will be coregistered to this file. Typically, this is the most 'nadir', or downward-looking , of the epipolar pair; however, you can use either the left or right image as input for this parameter.
RGHTFILE
The file containing the right-epipolar image.
EXTINTER
The extraction interval for the DSM. The values you can specify are 1 , 2 , 4 , 8 , 16 or 32 .
Typically, a value of 1 (full-resolution) or 2 (half-resolution) is used for high detail. You can use a higher value, such as 8 , to generate a quick preview, which you can use to check quality before generating a higher-resolution DSM.
FILEDEM
The name of the output file to which to write the computed DSM. This file is created automatically and will contain the raster DSM (elevation), imagery, and a quality band. This file will be in the epipolar geometry of the left image.
DEMFILT
The level of filtering to apply to the generated DSM. The process applies successive noise, median, and smoothing filters.
Internally, the LOW filter is "nm m=3 b=3" for satellite imagery and "nm r=5 b=3" for airborne imagery. The options applied with the MEDIUM and HIGH filters vary based on the type of input data and resolution.
COSTFUNC
The SGM cost function to use.
The cost function can influence the quality of the final DSM. The MI method provides more precise detail, but may introduce cross-hatching, terracing, or both in areas of uniform contrast. The NCC method has less detail, but is also less affected by areas of poor data quality.
PENALTY
The penalty value based on the value of COSTFUNC.
That is, the Semi Global Matching algorithm uses two penalty values (P1 and P2) that influence the quality of the results. If left unspecified, the internal defaults of 40, 10000 are used when COSTFUNC is Mutual Information (MI) and 50, 3000 when COSTFUNC is Normalized Cross-Correlation (NCC). Values ranging from 5 through 200 are typical for P1, and 250 to 5000 for P2. P2 must be greater than P1.
SEGSIZE
The threshold at which to eliminate segments and interpolate values of the digital elevation model (DEM) from the surrounding data. A segment is a small, isolated group of matching pixels. Blunders often occur in these segments.
Typically, values ranging from 16 through 128 provide satisfactory results in most cases. The default value is 32. A value of zero (0) switches off the operation.
DEMOPTS
The available options for special processing. Typically, you need not specify a value for this parameter.
| Back to top |
EPIPOLARDSM uses the Semi-Global Matching (SGM) method to create a DSM from a single, epipolar pair from stereo satellite, airphoto, or UAV data. With ADS line-scanner data, you can use Level 1 data without creating epipolar pairs. You can process data with resolutions ranging from 10 meters through less than 5 centimeters.
The DSM EPIPOLARDSM creates is in epipolar geometry and must be geocoded (in a separate step) before it can be useful.
You specify the epipolar pair with the LEFTFILE and RGHTFILE parameters. The concepts of left and right are used by convention; however, it is relevant whether the images are actually left and right. With some pairs, such as tristereo-satellite or ADS line-scanner imagery, you can use any combination of nadir, forward, and backward pairs. Typically, LEFTFILE is the most nadir (vertical-looking) image, and creates a DSM with less 'lean'. The output DSM is created automatically with the name specified for the FILEDEM parameter, and is in the same epipolar geometry as the image specified for the LEFTFILE parameter.
Image matching is always performed on the first band of the epipolar images; however, the DSM EPIPOLARDSM creates is consistent with whichever band is used.
With the EXTINTER parameter, you specify the extraction interval. The extraction interval is based on raster pixels and is available only in powers of two; that is, 1 , 2 , 4 , 8 , 16 or 32 . For example, if the ground sample distance (GSD) of the epipolar imagery is 50 centimeters, specifying an extraction interval of 1 will create a DSM of 50 centimeters, and an extraction interval of 4 will create a DSM of 2 meters.
You must know the GSD of the epipolar imagery and the resolution of the final geocoded DSM, and pick an appropriate extraction interval. To achieve better vertical accuracy, use a smaller extraction interval. For example, if the GSD is 15 centimeters, and you require a DSM of 50 centimeters, an extraction interval of 2 is preferable to an interval of 4 (an extraction interval of 3 would be ideal, but is not supported). An extraction interval of greater value will create a smaller file, and run significantly faster, but with less accuracy.
EPIPOLARDSM also generates a text segment, which provides processing information and statistics on the entire DSM and each processed tile.
Two penalty values, P1 and P2, control how features in the DSM are processed. The internal defaults for these are 40,10000 when the cost function is MI and 50, 3000 when the cost function is NCC. These values can range from 5 through 20000, though P2 must be greater than P1. Values such as 100,300 tend to produce flatter roads and fields, while values of 20,20000 tend to create smoother slopes.
EPIPOLARDSM has been evaluated for vertical accuracy. That is, assuming that the math models are correct, the image matching is, on average, about one fifth of a pixel on bare earth. The vertical accuracy is dependent on the viewing geometry with larger viewing angles providing better vertical accuracy. For example, if the viewing angle between the left and right images is 30 degrees with a 50-centimeter resolution GSD, the expected relative vertical error, on average, is:
1 / tan(viewing angle) * GSD * 1/5 = 1 / (tan 30) * 50 cm * 1/5 = 17 cm
With tristereo imagery (acquired by some satellites and ADS aerial line scanner), the best vertical accuracy comes from using forward and backward pairs in areas of relatively flat terrain. In areas of high relief, buildings, or both, using nadir and forward or nadir and backward (which have smaller viewing-angle differences) and merging the results in DSMs, produces fewer occluded areas and blunders with similar vertical accuracy to a backward/forward pair.
EPIPOLARDSM uses the Semi-Global Matching (SGM) method with a mutual-information or a small normalized cross-correlator cost function along eight or 16 paths. In contrast, the AUTODEM algorithm uses a larger normalized cross-correlator (NCC) for image matching along a single path (the epipolar line).
SGM is based on newer technology and produces higher-quality results with fewer errors and higher detail, but processing time is increased. However, if lower-resolution DSMs are adequate, and faster processing time is preferable, consider running AUTODEM to take advantage of the NCC method. For example, if you require a 4-meter DSM from 50-centimeter GSD data (an eight-to-one ratio).
In summary, run EPIPOLARDSM for high-resolution DSMs, but if you want to create a DSM faster, and, potentially, with superior low-resolution results, run AUTODEM .
| Back to top |
Example 1: Airphoto
You have an airphoto epipolar stereo pair, el_airphoto_005_006.pix and er_airphoto_005_006.pix , and you want to generate a DSM at full (one-to-one) resolution. The imagery requires a lot of smoothing so that DSM will be smooth on roads and open terrain. It is not necessary to preserve details on buildings, because they will be removed later to create a digital terrain model (DTM).
from pci.epipolardsm import epipolardsm leftfile = "el_airphoto_005_006.pix" rghtfile = "er_airphoto_005_006.pix" extinter = [1] filedem = "output_epipolar_airphoto_dsm.pix" demfilt = "high" costfunc = "MI" penalty = [] segsize = [] demopts = "" epipolardsm(leftfile, rghtfile, extinter, filedem, demfilt, costfunc, penalty, segsize, demopts)
Example 2: ADS line scanner
You have a single strip of Level 1 data from an ADS 80 line-scanner camera with separate images for the backward, nadir, and forward views. You select the forward and backward pair to get the best vertical accuracy and specify medium filtering to balance smoothness with detail. Because the forward image, in this case, is more downward-looking than the backward (17 degrees versus 23 degrees), you specify it as the left image. The GSD for the imagery is 40 centimeters and you want to produce a final DSM of 1 meter.
You also specify an extraction interval of 2 , which generates a nominal 80-centimeter GSD DSM. Later, during geocoding, you will resample the DSM to 1 meter. By creating a higher resolution than necessary at this step, the final geocoded DSM will be of a higher quality.
leftfile = "ADS_forward_F17.pix" rghtfile = "ADS_backward_B23.pix" extinter = [2] filedem = "output_epipolar_ADS_dsm.pix" demfilt = "medium" costfunc = "MI" penalty = [] segsize = [] demopts = "" epipolardsm(leftfile, rghtfile, extinter, filedem, demfilt, costfunc, penalty, segsize, demopts)
Example 3: Satellite
You have a Pleiades 50-centimeter PAN (panchromatic single-band) stereo satellite scene of a mining site. You require a highly accurate and detailed DSM to analyze the mine stockpile. Because the satellite image is extremely large, it will take several hours to run. Instead, you produce a fast overview at one-eighth resolution to ensure that there are no large unexpected errors in the imagery or math models.
The final DSM is produced at one-to-one resolution, with minimal filtering and epipolar tracking enabled to retain the best detail. With the DEMOPTS parameter, you specify "perfect epitrack" to retain only the most perfect matches, even though this will result in more interpolated pixels and longer processing time. Finally, you geocode the DSM, which retains the 50-centimeter resolution.
leftfile = "pleiades_left.pix" rghtfile = "pleiades_right.pix" extinter = [8] filedem = "mine_quick_overview.pix" demfilt = "medium" costfunc = "MI" penalty = [] segsize = [] demopts = "" epipolardsm(leftfile, rghtfile, extinter, filedem, demfilt, costfunc, penalty, segsize, demopts) #You can now check the overview for correctness in #CATALYST Professional # Focus or #another viewing tool and, if it is roughly correct, you can generate the #full-resolution DSM: extinter = [1] filedem = "mine_epipolar_dsm_50cm.pix" demfilt = "low" demopts = "perfect epitrack" epipolardsm(leftfile, rghtfile, extinter, filedem, demfilt, demopts) #After you generate the epipolar DSM, geocode it for final use: mfile = "mine_epipolar_dsm_50cm.pix" dbec = [1] dbscore = [3] dbiw = [] failvalu = [] backelev = [] demedit = "" demclip = "" filo = "mine_geocoded_dsm_50cm.pix" mapunits = "" upleft = [] loright = [] pxszout = [0.5,0.5] mergeopt = "blend" geocodedsm(mfile, dbec, dbscore, dbiw, failvalu, backelev, demedit, demclip, filo, mapunits, upleft, loright, pxszout, mergeopt)
| Back to top |
EPIPOLARDSM extracts the DSM by image-matching along epipolar lines by using the SGM method first proposed by Hirschmuller in 2005 (see References ). The SGM algorithm produces excellent detail and few blunders, or errors , even at full resolution. However, the basic algorithm does have some drawbacks, such as a lot of computation time, very high memory consumption, and sensitivity to variations in local lighting conditions. With each organization or company's implementation of the SGM algorithm, different approaches have been taken to work around these difficulties with varying degrees of success.
The PCI Geomatics implementation of the SGM algorithm was developed by PCI Geomatics (PCI). It is proprietary and full details are not available. The PCI implementation uses a tiled approach based on pyramid resolutions with multiple cost functions (including mutual information) to achieve stability over varying local lighting conditions while retaining the highest possible detail. The algorithm can self-adjust to compensate for small errors in the epipolar line. Innovative memory-management techniques limit RAM usage to 2 GB or less, even if the disparity in the images is thousands of pixels (which can occur in some satellite scenes of mountain ranges). High levels of parallelism are achieved by using single instruction, multiple data (SIMD) instructions, and multiple CPU cores.
| Back to top |
Hirschmuller, H., 2005: Accurate and Efficient Stereo Processing by Semi-Global Matching and Mutual Information. Proc. IEEE Conference on CVPR, New York, NY.
Hirschmuller, H., 2008. Stereo Processing by Semi-Global Matching and Mutual Information. IEEE Transactions on Pattern Analysis and Machine Intelligence , 30(2).
© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.