Main Content

findNeighborsInRadius

Find neighbors within a radius of a point in the point cloud

Since R2020b

Description

[indices,dists] = findNeighborsInRadius(ptCloud,point,radius) returns the indices of neighbors within a radius of a query point in the input point cloud. ptCloud can be an unorganized or organized point cloud. The neighbors within a radius of the query point are computed by using the Kd-tree based search algorithm. This function requires a Computer Vision Toolbox™ license.

[indices,dists] = findNeighborsInRadius(___,Name,Value) specifies options using one or more name-value pair arguments in addition to the input arguments in the preceding syntaxes.

Input Arguments

collapse all

Point cloud, specified as a pointCloud object.

Query point, specified as a three-element vector of form [x y z].

Search radius, specified as a scalar. The function finds the neighbors within the specified radius around a query point in the input point cloud.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is 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 enclose Name in quotes.

Example: findNeighborsInRadius(ptCloud,point,radius,'Sort',true)

Sort indices, specified as a comma-separated pair of 'Sort' and a logical scalar. When you set Sort to true, the returned indices are sorted in the ascending order based on the distance from a query point. To turn off sorting, set Sort to false.

Number of leaf nodes, specified as a comma-separated pair consisting of 'MaxLeafChecks' and an integer. When you set this value to Inf, the entire tree is searched. When the entire tree is searched, it produces exact search results. Increasing the number of leaf nodes to check increases accuracy, but reduces efficiency.

Output Arguments

collapse all

Indices of stored points, returned as a column vector. The vector contains the linear indices of the radial neighbors stored in the point cloud.

Distances to query point, returned as a column vector. The vector contains the Euclidean distances between the query point and its radial neighbors.

References

[1] Muja, M. and David G. Lowe. "Fast Approximate Nearest Neighbors with Automatic Algorithm Configuration". In VISAPP International Conference on Computer Vision Theory and Applications. 2009. pp. 331–340.

Extended Capabilities

Version History

Introduced in R2020b