scanContextDistance

Distance between scan context descriptors

Description

example

dist = scanContextDistance(descriptor1,descriptor2) computes the normalized distance between scan context descriptors. Determine loop closure candidates using the computed distance.

A scan context descriptor is a 2-D global feature descriptor for a point cloud that can be used to detect loop closures. To extract a scan context descriptor fro a point cloud, use the scanContextDescriptor function.

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

Scan context descriptor of point cloud, specified as an M-by-N matrix. To ensure an accurate distance measurement, use the same radial range when extracting this descriptor as for descriptor2.

Data Types: single | double

Scan context descriptor of point cloud, specified as an M-by-N matrix. To ensure an accurate distance measurement, use the same radial range when extracting this descriptor as for descriptor1.

Data Types: single | double

Output Arguments

collapse all

Distance between the scan context descriptors, returned as a scalar in the range [0, 1]. A small value indicates that the scan contexts are likely to belong to the same location, and are loop closure candidates.

Data Types: single | double

Algorithms

  • The function computes the distance between scan context descriptors using a modified cosine distance and normalizes it to the range [0 to 1).

Introduced in R2020b