Main Content

addElevation

Add elevation to scene data using georeferenced point cloud

Since R2024a

Description

Add-On Required: This feature requires the Scenario Builder for Automated Driving Toolbox add-on.

elevatedSceneData = addElevation(sceneData,geoReferencedPointCloud) adds elevation to the input scene data sceneData by using the elevation information from the georeferenced point cloud geoReferencedPointCloud.

Note: This feature also requires a Lidar Toolbox™ license.

example

elevatedSceneData = addElevation(sceneData,geoReferencedPointCloud,Name=Value) specifies additional options using one or more name-value arguments. For example, CropSceneData=false adds elevation information to the scene without cropping the scene data. (since R2026a)

example

Examples

collapse all

Load a roadrunnerHDMap object into the workspace.

load("addElevationData.mat","rrMap")

Read a georeferenced point cloud for an area that represents the loaded roadrunnerHDMap object.

geoReferencedPointCloud = pcread("USGS_LPC_CA_NoCAL_3DEP_Supp_Funding_2018_D18_w2276n1958_Cropped_geoReferenced.pcd");

Use the point cloud to add elevation to the scene data from the roadrunnerHDMap object.

elevatedSceneData = addElevation(rrMap,geoReferencedPointCloud);

Overlay and plot the elevated scene data and georeferenced point cloud. Observe the elevation information added to the scene.

plot(elevatedSceneData)
hold on
pcshow(geoReferencedPointCloud)
hold off

Load 2D lane boundary points into the workspace.

load("addElevationData.mat","laneBoundaryPoints")

Read a georeferenced point cloud for an area that contains the loaded 2D lane boundary points.

geoReferencedPointCloud = pcread("USGS_LPC_CA_NoCAL_3DEP_Supp_Funding_2018_D18_w2276n1958_Cropped_geoReferenced.pcd");

Use the point cloud to add elevations to the 2D lane boundary points.

elevatedLanes = addElevation(laneBoundaryPoints,geoReferencedPointCloud);

Overlay and plot the elevated lanes and georeferenced point cloud. Observe the elevation information added to the lane boundary points.

pcshow(geoReferencedPointCloud)
hold on
scatter3(elevatedLanes(:,1),elevatedLanes(:,2),elevatedLanes(:,3))
hold off

Load static object cuboids into the workspace.

load("addElevationData.mat","statObjs")

Read a georeferenced point cloud for an area that contains the loaded static object cuboids.

geoReferencedPointCloud = pcread("USGS_LPC_CA_NoCAL_3DEP_Supp_Funding_2018_D18_w2276n1958_Cropped_geoReferenced.pcd");

Add the elevation information from the point cloud to the static object cuboids by replacing their older elevation values, without cropping the lane boundary points.

elevatedCuboids = addElevation(statObjs,geoReferencedPointCloud,cropSceneData=false);

Overlay and plot the updated cuboids and georeferenced point cloud. Observe the elevation information added to the static object cuboids.

pcshow(geoReferencedPointCloud)
hold on
showShape("cuboid",elevatedCuboids)
hold off

Input Arguments

collapse all

Scene data to which to add elevation, specified as a roadrunnerHDMap object, N-by-2 matrix, or M-by-9 matrix.

Specify lane boundary points as an N-by-2 matrix, where N is the number of lane boundary points. Each row represents a lane boundary point in the form [x y]. For more information, see the Add Elevations to 2D Lane Boundary Points example.

Specify cuboids of static objects as an M-by-9 matrix, where M is the number of static objects. Each row of the matrix specifies a cuboid model of a static object using the form [xctr yctr zctr xlen ylen zlen xrot yrot zrot].

  • xctr, yctr, and zctr specify the coordinates of the cuboid center.

  • xlen, ylen, and zlen specify the length of the cuboid, in meters, along the x-, y-, and z-axes, respectively, before rotation has been applied.

  • xrot, yrot, and zrot specify the rotation angles, in degrees, for the cuboid along the x-, y-, and z-axes, respectively. These angles are clockwise-positive when looking in the forward direction of their corresponding axes.

This figure shows how these values determine the position of a cuboid. All values are in the world coordinate system.

For more information, see the Update Elevations of Static Object Cuboids example.

Note

For locations in the sceneData argument not included in the geoReferencedPointCloud argument, the addElevation function extrapolates values from the input point cloud to estimate elevation. These estimations can be imprecise. To estimate precise elevation, ensure that all locations in sceneData are included in geoReferencedPointCloud.

Geographically referenced point cloud data, specified as a pointCloud object. For more information on how to create a georeferenced point cloud, see the Georeference Sequence of Point Clouds for Scene Generation and Transform Aerial Point Cloud for Scene Generation examples.

Note

The input geoReferencedPointCloud must contain point cloud data in the east-north-up (ENU) coordinate system.

Name-Value Arguments

collapse all

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: addElevation(sceneData,geoReferencedPointCloud,CropSceneData=false) adds elevation information to the scene without cropping the scene data.

Since R2026a

Crop the scene data, specified as a logical 1 (true) or 0 (false). Specify true to crop the input scene data sceneData within the boundary of the input georeferenced point cloud data geoReferencedPointCloud. Otherwise, if you specify false and the scene contains any static objects or lane boundaries outside the boundary of the input georeferenced point cloud, the function does not crop the additional scene data.

Since R2026a

Step size of the 3D box grid filter used to voxelize the input georeferenced point cloud, specified as a positive scalar. Decrease the GridStep value to improve the accuracy of the addElevation function.

Output Arguments

collapse all

Scene data with elevations added from the input geoReferencedPointCloud, returned as a roadrunnerHDMap object, N-by-3 matrix, or an M-by-9 matrix.

The function returns one of these outputs based on the value of sceneData.

  • RoadRunner HD Map — Elevated RoadRunner HD Map, returned as a roadrunnerHDMap object. For more information, see the Add Elevations to RoadRunner HD Map example.

  • Lane boundary points — Lane boundary points, returned as an N-by-3 matrix. N is the number of lane boundary points. Each returned lane boundary point is of the form [x y z]. The z-axis values represent the added elevation information. For more information, see the Add Elevations to 2D Lane Boundary Points example.

  • Static object cuboids — Cuboids of static objects, returned as an M-by-9 matrix. M is the number of static objects. Each row of the matrix contains a cuboid model of a static object of the form [xctr yctr zctr xlen ylen zlen xrot yrot zrot]. The zctr value represents the updated elevation information for each cuboid. For more information, see the Update Elevations of Static Object Cuboids example.

References

[1] "USGS Lidar Explorer Map." Accessed November 14, 2025. https://apps.nationalmap.gov/lidar-explorer/.

Version History

Introduced in R2024a

expand all