Main Content

e57FileReader

Read point cloud data from E57 file

Since R2023a

    Description

    An e57FileReader object stores the metadata present in an E57 file as read-only properties. Use these properties with the readPointCloud object function to read point cloud data from the file.

    The E57 file format, specified by the American Society for Testing and Materials (ASTM), stores data in a hierarchical tree structure based on XML data format. You can store multiple point clouds and images along with the metadata of the associated sensors. Each E57 file contains a Data3D element that stores the point cloud data and an Images2D element that stores images. For more information on the file format, see E57 File Format.

    Creation

    Description

    example

    e57Reader = e57FileReader(fileName) creates an e57FileReader object that reads point cloud data from an E57 file. The fileName argument, which specifies the absolute or relative path to the E57 file, sets the FileName object property. You specify fileName as character vector or string scalar.

    Properties

    expand all

    This property is read-only.

    Name of the E57 file, stored as a character vector.

    This property is read-only.

    Format name in the E57 file header, stored as a character vector.

    This property is read-only.

    Globally unique identifier in the E57 file header, stored as a character vector.

    This property is read-only.

    E57 file version, stored as a character vector.

    This property is read-only.

    Library version used to save the E57 file, stored as a character vector.

    This property is read-only.

    File creation date and time, stored as a datetime object.

    This property is read-only.

    Number of point clouds in the E57 file, stored as a nonnegative integer.

    Object Functions

    readPointCloudRead point cloud data from E57 file
    hasCRSDataCheck if E57 file has CRS data
    readCRSRead coordinate reference system data from E57 file

    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.

    Algorithms

    The E57 file format is a general purpose, open standard format that stores point cloud data from lidar sensors, 3-D scanners, and stereo vision systems, as well as stores 2-D image data produced by cameras. The format can also store the core metadata associated with the sensors that captured its data. This file format is flexible and easy to interpret.

    Each E57 file has a hierarchical tree structure based on the XML format. An E57 file has a header, a binary section, and an XML section.

    E57 file format.

    • Header — Contains information such as the file version number and the location of the XML section.

    • Binary section — Contains the actual data of the point clouds and images.

    • XML section — Contains a hierarchical tree that references the data stored in the binary section.

      This figure shows the typical structure of the XML section.

      XML section of the E57 file.

      The E57Root element is the root node of the XML hierarchy. It stores point clouds and images in a common file coordinate system. The structure also contains additional file information, such as file creation date and time.

      Data3D element stores each point cloud as an individual structure. Each structure stores the pose information and individual point attributes of the point cloud.

      Images2D element stores images as individual structures, similar to the Data3D element.

      For more information on the E57 file format, see the standard specification on the ASTM INTERNATIONAL website.

    Version History

    Introduced in R2023a