Main Content

findNeighborsInRadius

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

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.

[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 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: 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

See Also

Introduced in R2020b