Contenido principal

snap

R2026b

Create SNAP model for point cloud segmentation

Since R2026b

    Description

    Add-On Required: This feature requires the Point Cloud Toolbox Model for SNAP Segmentation Network add-on.

    The snap object creates a pretrained Segment Anything in Any Point Cloud (SNAP) model for segmenting objects in point cloud data. The object enables you to segment indoor, outdoor, and aerial point cloud scenes by configuring the model for a specific scene type. The pretrained SNAP model uses only the XYZ coordinates of the input point cloud and ignores additional point attributes, such as color and intensity.

    Use the segmentObjects object function to segment user-specified objects using foreground point prompts. Use the segmentAllObjects function to automatically perform instance-level segmentation of all objects in a scene.

    Creation

    Description

    segmenter = snap(sceneType) creates a pretrained SNAP model configured for the specified scene type.

    The pretrained SNAP model has been trained on multiple point cloud data sets spanning indoor, outdoor, and aerial scenes. For example, indoor data is associated with the ScanNet data set, outdoor data with KITTI, nuScenes, and PandaSet data sets, and aerial data with STPLS3D and DALES data sets.

    example

    Input Arguments

    expand all

    Point cloud scene type, specified as "Indoor", "Outdoor", or "Aerial".

    This argument sets the sceneType property.

    Note

    To use this functionality, your system must have a CUDA® enabled NVIDIA® GPU. For information on the supported compute capabilities, see GPU Computing Requirements (Parallel Computing Toolbox).

    Data Types: char | string

    Output Arguments

    expand all

    SNAP segmentation model, returned as a snap object.

    Properties

    expand all

    This property is read-only after object creation. To set this property, use the sceneType input argument when calling the snap function.

    Point cloud scene type, represented as "Indoor", "Outdoor", or "Aerial".

    Data Types: char | string

    Object Functions

    segmentObjectsSegment selected objects in point cloud using SNAP model
    segmentAllObjectsSegment all objects automatically in point cloud using SNAP model
    releaseGPUMemoryRelease GPU memory allocated for model

    Examples

    collapse all

    Create a SNAP segmentation model configured for outdoor point cloud data.

    segmenter = snap("Outdoor");

    Read the input point cloud representing outdoor urban driving scene.

    ptCloud = pcread("PandasetLidarData.pcd");

    Specify a point prompt that lies inside the object of interest. The prompt guides the model to segment the corresponding object.

    pointPrompt = [3 5 -0.5];

    Display the input point cloud and overlay the point prompt.

    figure(Position=[100 100 500 500])
    pcshow(ptCloud)
    hold on
    plot3(pointPrompt(1),pointPrompt(2),pointPrompt(3), ...
        ".r",MarkerSize=20)
    hold off
    zoom(5)

    Segment the object using the segmentObjects object function.

    [mask,label,score] = segmentObjects(segmenter,ptCloud,pointPrompt);

    Release GPU memory allocated to the SNAP model.

    releaseGPUMemory(segmenter)

    Visualize the segmented object overlaid on the point cloud.

    figure(Position=[100 100 500 500])
    pcshow(ptCloud.Location,single(mask))
    zoom(5)

    Display the predicted label.

    disp(label)
         Car 
    

    References

    [1] Gupta, Aniket, Hanhui Wang, Charles Saunders, Aruni RoyChowdhury, Hanumant Singh, and Huaizu Jiang. “SNAP: Towards Segmenting Anything in Any Point Cloud.” Preprint, arXiv, 2025.

    Version History

    Introduced in R2026b