Main Content


Segment vegetation points from aerial lidar data

Since R2022b


    vegetationPtsIdx = segmentAerialLidarVegetation(ptCloud) segments the vegetation points and non-vegetation points from the input unorganized point cloud ptCloud using a pretrained PointNet++ model and returns the building point indices.


    • The input point cloud dimensions must be in meters.

    • This function requires Deep Learning Toolbox™.


    [vegetationPtsIdx,nonVegetationPtCloud,vegetationPtCloud] = segmentAerialLidarVegetation(ptCloud) additionally returns the vegetation points and non-vegetation points as individual pointCloud objects.

    [___] = segmentAerialLidarVegetation(___,ExecutionEnvironment=env) specifies the execution environment for the function in addition to any combination of arguments from previous syntaxes.


    collapse all

    Specify a LAZ file that contains aerial lidar data.

    fileName = fullfile(toolboxdir("lidar"),"lidardata","las", ...

    Read point cloud data from the LAZ file into the workspace.

    lasReader = lasFileReader(fileName);
    ptCloud = readPointCloud(lasReader);

    Segment the vegetation points from the point cloud.

    [~,nonVegetationPtCloud,vegetationPtCloud] = segmentAerialLidarVegetation(ptCloud);

    Visualize the vegetation and non-vegetation points.


    Input Arguments

    collapse all

    Unorganized point cloud data, specified as a pointCloud object.

    Hardware resource to use to process the point cloud, specified as one of these options.

    • "auto" — Use a GPU if available. Otherwise, use the CPU. The use of a GPU requires Parallel Computing Toolbox™ and a CUDA®-enabled NVIDIA® GPU. For information about the supported compute capabilities, see GPU Computing Requirements (Parallel Computing Toolbox).

    • "gpu" — The function uses a GPU. If a suitable GPU is not available, the function returns an error message.

    • "cpu" — The function uses a CPU.

    Data Types: char | string

    Output Arguments

    collapse all

    Binary map of the segmented point cloud, returned as an M-element logical vector. Elements that correspond to vegetation points in the point cloud are true, and non-vegetation points are false.

    Point cloud of non-vegetation points, returned as a pointCloud object.

    Point cloud of vegetation points, returned as a pointCloud object.

    Version History

    Introduced in R2022b