Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

findNeighborsInRadius

Class: pointCloud

Find neighbors within a radius

Syntax

[indices,dists] = findNeighborsInRadius(ptCloud,point,radius)
[indices,dists] = findNeighborsInRadius(ptCloud,point,radius,Name, Value)

Description

[indices,dists] = findNeighborsInRadius(ptCloud,point,radius) returns the neighbors within a radius of a query point.

[indices,dists] = findNeighborsInRadius(ptCloud,point,radius,Name, Value) uses additional options specified by one or more Name,Value arguments.

Input Arguments

expand all

Point cloud, specified as a pointCloud object.

Query point, specified as an [X,Y,Z] vector.

Radius, specified as a scalar. The function finds the neighbors within the radius of a query point.

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 single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

expand all

Sort indices, specified as 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 sorting off, set Sort to false.

Number of leaf nodes, specified as an integer. Set MaxLeafChecks to the number of leaf nodes to search in the Kdtree. 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

expand all

Indices of stored points, returned as a column vector. The indices output contains K linear indices to the stored points in the point cloud.

Distances to query point, returned as a column vector. The dists contains K Euclidean distances to the query point.

Examples

expand all

Create a point cloud object with randomly generated points.

    ptCloud = pointCloud(100*rand(1000,3,'single'));

Define a query point and set the radius.

    point = [50,50,50];
    radius =  5;

Get all of the points within the radius.

    [indices, dists] = findNeighborsInRadius(ptCloud,point,radius)
indices =

  0x1 empty uint32 column vector


dists =

  0x1 empty single column vector

References

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.

Introduced in R2015a