scanContextDescriptor

Extract scan context descriptor from point cloud

Description

example

descriptor = scanContextDescriptor(ptCloud) extracts a scan context descriptor from a point cloud, ptCloud.

A scan context descriptor is a 2-D global feature descriptor of a point cloud that can be used to detect loop closures. The function computes the descriptor by first binning points from a 3-D point cloud scan into concentric radial and azimuthal bins, and then selecting the maximum z-height of points in each bin.

descriptor = scanContextDescriptor(ptCloud,Name,Value) specifies options using one or more name-value pair arguments.

Examples

collapse all

Create a Velodyne® packet capture (PCAP) file reader.

veloReader = velodyneFileReader('lidarData_ConstructionRoad.pcap','HDL32E');

Read the 1st, 2nd, and 100th scan into the workspace.

ptCloud1   = readFrame(veloReader,1);
ptCloud2   = readFrame(veloReader,2);
ptCloud100 = readFrame(veloReader,100);

Extract scan context descriptors from each of the point clouds.

descriptor1   = scanContextDescriptor(ptCloud1);
descriptor2   = scanContextDescriptor(ptCloud2);
descriptor100 = scanContextDescriptor(ptCloud100);

Compute the descriptor distance between the 1st and 2nd scan context descriptors, and between the 1st and 100th scan context descriptors.

dist1to2   = scanContextDistance(descriptor1,descriptor2);
dist1to100 = scanContextDistance(descriptor1,descriptor100);

Display the scan context descriptor distances.

disp("Descriptor distance from frame 1 to 2   : " + num2str(dist1to2))
Descriptor distance from frame 1 to 2   : 0.087646
disp("Descriptor distance from frame 1 to 100 : " + num2str(dist1to100))
Descriptor distance from frame 1 to 100 : 0.32427

Input Arguments

collapse all

Point cloud object, specified as pointCloud object.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'NumBins',[20 60] sets the number of radial bins to 20, and the number of azimuthal bins to 60.

Number of concentric radial and angular bins, specified as the comma-separated pair consisting of 'NumBins' and a vector of the form [numRadialBins numAzimuthalBins], where numRadialBins is a positive integer that specifies the number of concentric radial bins and numAzimuthalBins specifies the number of concentric angular bins. To extract more compact descriptors, you can decrease the number of bins, but this reduces the discriminative power.

Minimum number of points for a bin to be included in descriptor, specified as the comma-separated pair consisting of 'MinPointsPerBin' and a positive integer. Bins that do not contain the minimum number of points are not included in the descriptor. For these bins, the function returns NaN. To reduce the chances for noise to be included as a bin, increase this value.

Sensor origin, specified as the comma-separated pair consisting of 'SensorOrigin' and a two-element vector. The elements set the x- and y-axis coordinate points, respectively, of the sensor origin in world units. The function centers the bins around the origin of the scan.

Radial bounds of the descriptor used when binning points, specified as the comma-separated pair consisting of 'RadialRange' and a two-element vector in the form [rmin,rmax]. Use this name-value argument to restrict the spatial bounds covered by the descriptor.

Output Arguments

collapse all

Scan context descriptor, returned as an M-by-N matrix, where M and N are the number of concentric radial and angular bins, respectively, in the descriptor. These are specified by the NumBins property.

The function returns inherits the data type of the Location property of the input point cloud.

Data Types: single | double

Tips

  • The scan context descriptor function assumes that the sensor is mounted roughly horizontally and that the input point cloud is in the sensor coordinate system.

  • To determine loop closure candidates, compare the distance between two scan context descriptors using the scanContextDistance function.

Introduced in R2020b