Main Content

ibeoMessageReader

Object for reading message content from Ibeo Data Container (IDC) file

Since R2021a

Description

The ibeoMessageReader object is an indexed selection of the messages in an Ibeo® IDC file. Use this object to read message content from an IDC file. Each ibeoMessageReader object contains content for only messages of the selected type from an ibeoFileReader object.

Creation

To create an ibeoMessageReader object, use the select object function of the ibeoFileReader object.

ibeoReader = ibeoFileReader('sample_data.idc');
msgReader = select(ibeoReader,'image');

Properties

expand all

This property is read-only.

Absolute path to IDC file, specified as a string scalar.

This property is read-only.

Timestamp of the first message, specified as a datetime scalar.

This property is read-only.

Timestamp of the last message, specified as a datetime scalar.

Timestamp of the current message, specified as a datetime scalar.

This property is read-only.

Timestamps of all messages, specified as a N-by-1 datetime vector. N is the number of messages in the selection.

This property is read-only.

Total duration of the selection, specified as a duration scalar in seconds.

This property is read-only.

Selected message type, specified as a string scalar.

This property is read-only.

Number of messages in the selection, specified as a nonnegative integer.

This property is read-only.

IDs of the devices associated with the selection, specified as a vector of nonnegative integers.

Object Functions

readMessagesRead messages from Ibeo Data Container (IDC) file selection
readNextMessageRead next message from Ibeo Data Container (IDC) file selection
hasNextMessageCheck if Ibeo Data Container (IDC) file selection has next message
resetReset to first message in Ibeo Data Container (IDC) file selection

Examples

collapse all

Create an ibeoFileReader object, ibeoReader, to read the message headers from an IDC file. Replace the placeholder argument sample_data.idc with the name of your IDC file as sample_data.idc file is not provided with the toolbox.

ibeoReader = ibeoFileReader('sample_data.idc')
ibeoReader =
 
  ibeoFileReader with properties:
 
       FileName: "C:/Documents/MATLAB/ibeo_data/sample_data.idc"
      StartTime: 15-Mar-2020 11:21:04.999434999
        EndTime: 15-Mar-2020 11:25:35.030095000
       Duration: 00:04:30
    FileSummary: CAN             53    msgs [0x1002]
                 scan            53    msgs [0x2205]
                 object          106   msgs [0x2281]
                 image           53    msgs [0x2403]
                 vehicleState    53    msgs [0x2808]
                 measurementList 53    msgs [0x2821]
                 pointCloudPlane 53    msgs [0x7510]
                 unsupported     53    msgs [0x6120]
                 unsupported     53    msgs [0x6970]

Create two ibeoMessageReader objects, imgReader and objReader, to read all image and object detection messages in the first 2 minutes, respectively, by using the select function with appropriate message type and time range values.

timeRange = [0 minutes(2)];
imgReader = select(ibeoReader,'image',timeRange);
objReader = select(ibeoReader,'object',timeRange);

Read the first 10 images and all object detection messages in the first 2 minutes, by using the readMessages function on the respective ibeoMessageReader objects with appropriate indices and timeRange arguments. Reading object detection messages returns both online objects and postprocessed objects along with their metadata.

imgs = readMessages(imgReader,1:10);
[rawObjs,procObjs,rawMetadata,procMetadata] = readMessages(objReader);

Create an ibeoFileReader object, ibeoReader, to read the message headers from the IDC file. Replace the placeholder argument sample_data.idc with the name of your IDC file as sample_data.idc file is not provided with the toolbox.

ibeoReader = ibeoFileReader('sample_data.idc')
ibeoReader =
 
  ibeoFileReader with properties:
 
       FileName: "C:/Documents/MATLAB/ibeo_data/sample_data.idc"
      StartTime: 15-Mar-2020 11:21:04.999434999
        EndTime: 15-Mar-2020 11:25:35.030095000
       Duration: 00:04:30
    FileSummary: CAN             53    msgs [0x1002]
                 scan            53    msgs [0x2205]
                 object          106   msgs [0x2281]
                 image           53    msgs [0x2403]
                 vehicleState    53    msgs [0x2808]
                 measurementList 53    msgs [0x2821]
                 pointCloudPlane 53    msgs [0x7510]
                 unsupported     53    msgs [0x6120]
                 unsupported     53    msgs [0x6970]

Create an ibeoMessageReader object, imgReader, to read all images in the first 2 minutes, by using the select function with appropriate message type and time range values.

timeRange = [0, minutes(2)];
imgReader = select(ibeoReader, 'image', timeRange);

Visualize the message data by reading the messages one at a time to a video player object. First, create a vision.VideoPlayer object. Then, use the hasNextMessage function to check whether imgReader contains a message after the current one. If it does, use readNextMessage function to read the images into the workspace.

videoPlayer = vision.VideoPlayer;
while hasNextMessage(imgReader)
    img = readNextMessage(imgReader);
    step(videoPlayer,img);
end
release(videoPlayer);
     

Reset the ibeoMessageReader object, imgReader, to the first message in the selection, using the reset function.

 reset(imgReader);

Tips

  • If the MessageType property value is 'object', and if the IDC file contains both online objects and postprocessed objects, the StartTime, EndTime, CurrentTime, Timestamps, Duration, and NumMessages properties are determined by only the online object messages.

  • If the MessageType value is 'object', and the IDC file contains only postprocessed messages, the Timestamps property corresponds to the postprocessing time, not the time of data collection. For synchronization purposes, use the MidScanTimeStamp field from the object metadata returned by the readMessages or readNextMessage object function.

Version History

Introduced in R2021a