Contenido principal

hasPointCloud

R2026b

Determine if another point cloud is available in E57 file

Since R2026b

    Description

    flag = hasPointCloud(e57Reader) determines if another point cloud is available to read from the E57 file associated with the e57FileReader object e57Reader.

    example

    Examples

    collapse all

    Download a ZIP file containing an E57 file, and then unzip the file.

    zipFile = matlab.internal.examples.downloadSupportFile("lidar","data/e57ParkingLot.zip");
    saveFolder = fileparts(zipFile);
    e57FileName = [saveFolder filesep 'parkingLot.e57'];
    if ~exist(e57FileName,"file")
        unzip(zipFile,saveFolder)
    end

    Create an e57FileReader object using the downloaded E57 file.

    e57Reader = e57FileReader(e57FileName);

    Define a variable for storing point clouds, ptCloudArr and their corresponding poses, tformArr.

    ptCloudArr = [];
    tformArr = []; 

    Read the point clouds sequentially. Use the hasPointCloud object function to check whether the next point cloud is available.

    while hasPointCloud(e57Reader)
       [ptCloud,pcMetadata] = readPointCloud(e57Reader);
        for j = 1:numel(ptCloud) % To read multiple returns
            ptCloudArr = [ptCloudArr ptCloud(j)];
            tformArr = [tformArr pcMetadata.RelativePose];
        end
    end

    Align the point clouds from the file to create a map.

    pcMap = pcalign(ptCloudArr,tformArr); 

    Display the map.

    figure
    pcshow(pcMap)

    Figure contains an axes object. The axes object contains an object of type scatter.

    Input Arguments

    collapse all

    E57 file reader, specified as an e57FileReader object.

    Output Arguments

    collapse all

    Next point cloud availability flag, returned as a 1 or 0 of data type logical. This value is logical 1 if the E57 file associated with the e57FileReader object has one or more point clouds to read next. Otherwise, the value is a logical 0.

    Version History

    Introduced in R2026b