This example shows how to augment a geometric traversability map with semantic cost information derived from satellite imagery. You first compute a traversability map from a digital elevation model (DEM). You then fuse semantic segmentation data to penalize or promote specific terrain classes, resulting in a more realistic and task-aware traversability estimate.
Load the digital elevation model (DEM) of Manassas National Battlefield Park, Virginia, to visualize its height profile to understand the underlying geometry. The Zreal stores the elevation data and res specifies the grid resolution.
Visualize the digital elevation model (DEM) to inspect terrain features such as roads, elevation changes, and man-made structures.
Create geometric traversability map for the terrain from the digital elevation model (DEM) by specifying the SlopeThreshold property and disabling the RoughnessThreshold and StepHeightThreshold properties. This configuration highlights large-scale geometric features of the terrain.
Visualize resulting geometric traversability map.
The geometric traversability map captures features such as roads, open regions, and building boundaries based solely on terrain shape. However, geometry alone cannot distinguish between visually similar but semantically different regions, such as grass versus paved roads.
Now, load the satellite image corresponding to the same location and dimensions. This image provides visual cues for identifying terrain classes such as roads, vegetation, and buildings.
Load semantic segmentation masks generated for the satellite image. Each mask represents a specific semantic class, such as roads, trees, grass, or buildings. These masks were generated using the Get Started with the Image Labeler (Computer Vision Toolbox) app or can be produced using automated segmentation models.
masks =
dictionary (string ⟼ cell) with 5 entries:
"low_grass" ⟼ {1027×1027 double}
"trees" ⟼ {1027×1027 double}
"building" ⟼ {1027×1027 double}
"road" ⟼ {1027×1027 double}
"soil" ⟼ {1027×1027 double}
Assign semantic cost to each terrain class. Lower costs indicate preferred traversal regions, while higher costs represent obstacles or restricted areas.
For semantic classes such as roads, assign a cost of 0. For obstacles like trees, assign a cost of 1. And for classes such as grass or soil, assign a cost between 0 and 1.
Compute combined semantic cost map by weighting each semantic mask with its corresponding cost.
Resize semantic cost map to match the resolution of the elevation data.
Integrate semantic cost map with the geometric traversability map. This step adjusts traversability scores based on semantic context.
Integrate the semantic cost map with the geometric traversability map. This step adjusts traversability scores based on semantic context.