Main Content

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 maximumz-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 30th scan into the workspace.

ptCloud1 = readFrame(veloReader,1); ptCloud2 = readFrame(veloReader,2); ptCloud30 = readFrame(veloReader,30);

Extract scan context descriptors from each of the point clouds.

descriptor1 = scanContextDescriptor(ptCloud1); descriptor2 = scanContextDescriptor(ptCloud2); descriptor30 = scanContextDescriptor(ptCloud30);

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

dist1to2 = scanContextDistance(descriptor1,descriptor2); dist1to30 = scanContextDistance(descriptor1,descriptor30);

Display the scan context descriptor distances.

disp(“备注说明iptor distance from frame 1 to 2: "+ num2str(dist1to2))
Descriptor distance from frame 1 to 2: 0.087647
disp(“备注说明iptor distance from frame 1 to 30: "+ num2str(dist1to30))
Descriptor distance from frame 1 to 30: 0.31551

Input Arguments

collapse all

Point cloud object, specified aspointCloudobject.

Name-Value Arguments

Specify optional pairs of arguments asName1=Value1,...,NameN=ValueN, whereNameis the argument name andValueis the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and encloseNamein quotes.

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

Number of concentric radial and angular bins, specified as the comma-separated pair consisting of'NumBins'and a vector of the form [numRadialBinsnumAzimuthalBins], wherenumRadialBinsis a positive integer that specifies the number of concentric radial bins andnumAzimuthalBinsspecifies 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 returnsNaN. 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'和一个双元素向量。集合的元素x- andy-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 anM-by-Nmatrix, whereMandNare the number of concentric radial and angular bins, respectively, in the descriptor. These are specified by theNumBinsproperty.

The function returns inherits the data type of theLocationproperty 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 thescanContextDistancefunction.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2020b