Get Started with Lidar Viewer
Use the Lidar Viewer app to view, analyze, and perform preprocessing operations on lidar data. Use the app to prepare data for advanced workflows like labeling, segmentation, and calibration.
This topic provides an overview of the app workflow and underlying features. To open the app, at the MATLAB® command prompt, enter this command.
Alternatively, you can open the app from the Apps tab, under Image Processing and Computer Vision.
The Lidar Viewer app can import
pointCloud objects from the workspace and read point cloud data from PLY, PCAP,
LAS, LAZ, PCD, and rosbag files. You can load lidar data from multiple sources at once. Use
this process to load data into the app:
On the app toolstrip, select Import > From File. Choose a data source from the list.
In the Import dialog box that appears, specify the location of the point cloud data from the selected data source.
Point Cloud Sequence — In the Provide path to a folder containing PCD/PLY file(s) box, specify the path to the folder containing your point cloud data. Alternatively, select Browse, browse to the folder containing your data, and then select Select Folder.
Velodyne Lidar — For Velodyne® lidar data, select the device model name from the Device Model list. In the Provide path to a calibration file box, specify the path to the calibration file of the sensor.
LAS/LAZ File— In the Provide path to a LAS/LAZ file box, specify the path to the folder containing your point cloud data. Alternatively, select Browse, browse to the folder containing your data, and then select Select Folder.
Rosbag — For rosbag files, select the topics that contain point cloud data from the Point Cloud Topics list. To load data from a rosbag file, you must have a ROS Toolbox license.
Custom Point Cloud — To load point cloud data from a custom source, create a custom reader function and add it to your MATLAB path. In the Custom Reader Function box specify the path to the reader function, and in the Source Name box specify the path to the data folder.
Alternatively, select Import > From Workspace on the app toolstrip. In the Import From Workspace dialog box that appears, select the variables/ objects from the workspace you want to import.
The app loads and plots point cloud data in the Point Cloud Display pane.
The Lidar Viewer app organizes loaded data, based on the order you import it, as a list in the Data Browser pane. To delete the imported data, right click on the data you want to delete and select Delete Data.
Select the data that you want to visualize. The metadata of the point cloud populates in the Point Cloud Information pane. The information and fields change based on the data source and available metadata.
The visualization pane displays the point cloud data along with playback controls in the Playback Slider.
The Playback Slider pane contains a slider that indicates your current position in the point cloud sequence, as well as buttons to control the playback of the point cloud data. The buttons, from left to right, are:
If you select Play, the Play button becomes the Pause button, and all the playback controls except Pause are disabled.
For point cloud data with timestamp information such as PCAP, rosbag files, the app displays start time, current time, and end time on the Playback Slider pane.
Lidar Viewer provides various visualization features to analyze point cloud data. The app uses color to visualize more details about the displayed point cloud.
You can control the color of the displayed point cloud by using these options in the Color section of the app toolstrip:
Camera View Options
The app provides various predefined camera angles for viewing the point cloud data, as well as the option to create custom views:
Edit Point Cloud
Apply preprocessing operations to a point cloud by selecting on the Edit Point Cloud from the app toolstrip. The app opens the Edit tab. This tab retains the color and visualization features present in the Lidar Viewer tab . You can select built-in preprocessing operations from the Algorithm section of the toolstrip:
After selecting an algorithm, the app populates the Algorithm Parameters pane with the corresponding tunable parameters.
The Lidar Viewer app dynamically updates the point cloud as you tune the parameters, enabling you to see the results in realtime. Select Apply All Frames to apply the algorithm to all the frames in the data source. After tuning your parameters select OK. The History pane records all preprocessing operations applied to the current frame. You can apply the same algorithm multiple times on the data using OK. Select Cancel to exit the edit algorithm.
You can discard all applied algorithms by selecting Discard
Operations. You can also export the selected preprocessing steps and the
parameters, as a function by selecting Export To Function. The app
creates a MAT file containing your custom preprocessing function. The function accepts a
pointCloud object as input and outputs the processed
Custom Preprocessing Algorithms
You can create a new custom preprocessing algorithm or import an existing one into the app. Follow these steps to apply a custom preprocessing algorithm to your data.
Click Add Algorithm. To apply your algorithm to only a single point cloud frame, select an option from the Spatial Algorithms section. To apply your algorithm to multiple point cloud frames, select an option from the Temporal Algorithms section.
To create a new algorithm, select New. Select whether to create an algorithm using a Class Template or a Function Template. MATLAB opens a new MAT file that contains a code framework and directions to create your custom algorithm. With the template, you can also define user interface (UI) elements for parameter tuning. These UI elements appear in the Algorithm Parameters pane.
To import your algorithm into the app, first select Add Algorithm and, in the Spatial Algorithms or Temporal Algorithms section, select From File. Then, select Import Class or Import Function. In the dialog box, select the file that contains the algorithm you want to import.
To finalize your edits to the point cloud and return to the Edit tab, on the app toolstrip, select Accept.
You can also export the history of edit operations to a function-based algorithm using Export To Function.
For more information on creating custom preprocessing workflows, see Create Custom Preprocessing Workflow with Lidar Viewer.
Export Point Cloud
You can export point clouds as PCD or PLY files. After processing your point clouds, on the app toolstrip, select Export Point Cloud. Lidar Viewer opens the Export Point Cloud dialog box.
Select the point clouds you want to export. Then, in the Provide path to the destination folder text box, specify or browse to the destination folder.
If the input point cloud data is in PLY format, the app exports it as a PLY file. If you load input data of any other format, the app exports them as PCD files.
Measure Point Cloud
You can measure point cloud attributes such as distance, angle, and volume using the tools in the Measurement tab.
To measure an attribute of the point cloud, select a measurement tool on the app toolstrip, then interactively select points on the point cloud to return the corresponding measurement.
Distance — Measure the distance between any two points in the point cloud.
Elevation — Measure the elevation between any two points in the point cloud.
Location — Obtain the xyz-coordinates of a point.
Angle — Select three points on the point cloud to measure the angles of the triangle defined by the points.
Volume — Measure the volume inside a cuboid region on the point cloud. You can interactively adjust the limits and the size of the cuboid.
The app deletes all your measurements in the current signal when you select Edit Point Cloud on the app toolstrip, or toggle to a different point cloud signal.