Main Content

readPointCloud

Read point cloud data from E57 file

Since R2023a

    Description

    example

    ptCloud = readPointCloud(e57Reader,ptCloudNum) reads the point cloud specified by the point cloud number ptCloudNum from the E57 file specified by the e57FileReader object e57Reader.

    [ptCloud,pcMetadata] = readPointCloud(___) returns the metadata of the point cloud read from the file using all input arguments from the previous syntax.

    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 cloud data.

    for i = 1:e57Reader.NumPointClouds
       [ptCloud,pcMetadata] = readPointCloud(e57Reader,i);
        for j = 1:numel(ptCloud)
            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.

    Point cloud number to read from the file, specified as a positive integer. This value must be less than or equal to the total number of point clouds in the file, as indicated by the value of the NumPointClouds property of the e57Reader input.

    Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

    Output Arguments

    collapse all

    Point cloud read from the file, returned as a pointCloud object. The function returns organized point clouds when the file contains organization information. Otherwise, it returns unorganized point clouds.

    Note

    The function returns an array of organized point clouds when the file contains organization information for multiple returns.

    Point cloud metadata, returned as a structure with these fields.

    FieldDescription
    PointAttributes

    Attributes of the points in the point cloud, returned as a structure containing these fields.

    • Classification — Classification value, returned as a nonnegative integer.

    • ReturnCount — Return count, returned as a positive integer.

    • ReturnIndex — Return index, returned as a nonnegative integer.

    • TimeStamp — Timestamp value, in seconds.

    For an unorganized point cloud, each of these fields is an M-element vector. M is the number of points in the point cloud.

    For an organized point cloud, each of these fields is an M-by-N matrix. M and N are the number of rows and columns of the point cloud, respectively.

    Note

    The function returns PointAttributes as an array of structures when it returns an array of point clouds.

    RelativePoseRigid transformation of the point cloud from the sensor local coordinate system to the file coordinate system, returned as a rigidtform3d object.
    AcquisitionPeriodAbsolute start time and end time between which the sensor records the point cloud, respectively returned as a two-element datetime vector.
    GUIDGlobally unique identifier (GUID) of the point cloud in the Data3D element of the file, returned as a character vector.
    OriginalGUIDsGUIDs of the data sets to which the points in the Data3D element belong, returned as a cell array of character vectors.
    NameUser-defined name of the Data3D element, returned as a character vector.
    DescriptionUser-defined description for the Data3D element, returned as a character vector.
    CartesianBounds

    Allowed bounds for the Cartesian coordinates of the points in the Data3D element, returned as a six-element vector of the form [xmin xmax ymin ymax zmin zmax]. Values are in meters.

    SphericalBounds

    Allowed bounds for the Spherical coordinates of the points in the Data3D element, returned as a structure with these fields.

    FieldDescription
    RangeMinimum and maximum bounds for the range, returned as respective elements of a two-element nonnegative vector. Values are in meters.
    ElevationMinimum and maximum bounds for the elevation angle, returned as respective elements of a two-element vector. Values are in radians.
    AzimuthMinimum and maximum bounds for the azimuth angle, returned as respective elements of a two-element vector. Values are in radians.

    IndexBounds

    Bounds for point indices, returned as a structure with these fields.

    FieldDescription
    RowMinimum and maximum bounds for the row indices of the points in the point cloud, returned as respective elements of a two-element nonnegative vector.
    ColumnMinimum and maximum bounds for the column indices of the points in the point cloud, returned as respective elements of a two-element nonnegative vector.
    ReturnMinimum and maximum bounds for the return indices of the points in the point cloud, returned as respective elements of a two-element nonnegative vector.

    SensorData

    Metadata of the lidar sensor capturing the point cloud, returned as a structure with these fields.

    NameDescription
    VendorName of the lidar sensor vendor, returned as a character vector.
    ModelModel name or model number of the lidar sensor, returned as a character vector.
    SerialNumberSerial number of the lidar sensor, returned as a character vector.
    HardwareVersionHardware version of the lidar sensor, returned as a character vector.
    SoftwareVersionSoftware version of the lidar sensor, returned as a character vector.
    FirmwareVersionFirmware version of the lidar sensor, returned as a character vector.
    IntensityLimitsMinimum and maximum producible intensity of the lidar sensor, returned as respective elements of a two-element vector.
    ColorLimits

    Minimum and maximum producible color limits of the sensor, returned as six-element vector of the form [redmin redmax greenmin greenmax bluemin bluemax] .

    WeatherData

    Weather data, returned as a structure with these fields.

    • Temperature — Temperature in degree Celsius.

    • RelativeHumidity — Relative humidity in percentage.

    • AtmosphericPressure — Atmospheric pressure in Pascals.

    For more information on the E57 file format, see E57 File Format.

    Version History

    Introduced in R2023a