A Class for nearest neighbor search.
More...
#include <NearestNeighborSearch.h>
|
| NearestNeighborSearch (const Tensor &dataset_points, const Dtype &index_dtype=core::Int32) |
|
| ~NearestNeighborSearch () |
|
| NearestNeighborSearch (const NearestNeighborSearch &)=delete |
|
NearestNeighborSearch & | operator= (const NearestNeighborSearch &)=delete |
|
bool | KnnIndex () |
|
bool | MultiRadiusIndex () |
|
bool | FixedRadiusIndex (utility::optional< double > radius={}) |
|
bool | HybridIndex (utility::optional< double > radius={}) |
|
std::pair< Tensor, Tensor > | KnnSearch (const Tensor &query_points, int knn) |
|
std::tuple< Tensor, Tensor, Tensor > | FixedRadiusSearch (const Tensor &query_points, double radius, bool sort=true) |
|
std::tuple< Tensor, Tensor, Tensor > | MultiRadiusSearch (const Tensor &query_points, const Tensor &radii) |
|
std::tuple< Tensor, Tensor, Tensor > | HybridSearch (const Tensor &query_points, const double radius, const int max_knn) const |
|
A Class for nearest neighbor search.
◆ NearestNeighborSearch() [1/2]
open3d::core::nns::NearestNeighborSearch::NearestNeighborSearch |
( |
const Tensor & |
dataset_points, |
|
|
const Dtype & |
index_dtype = core::Int32 |
|
) |
| |
|
inline |
Constructor.
- Parameters
-
dataset_points | Dataset points for constructing search index. Must be 2D, with shape {n, d}. SYCL tensors are not yet supported. |
◆ ~NearestNeighborSearch()
open3d::core::nns::NearestNeighborSearch::~NearestNeighborSearch |
( |
| ) |
|
◆ NearestNeighborSearch() [2/2]
◆ FixedRadiusIndex()
bool open3d::core::nns::NearestNeighborSearch::FixedRadiusIndex |
( |
utility::optional< double > |
radius = {} | ) |
|
Set index for fixed-radius search.
- Parameters
-
radius | optional radius parameter. required for gpu fixed radius index. |
- Returns
- Returns true if building index success, otherwise false.
◆ FixedRadiusSearch()
std::tuple< Tensor, Tensor, Tensor > open3d::core::nns::NearestNeighborSearch::FixedRadiusSearch |
( |
const Tensor & |
query_points, |
|
|
double |
radius, |
|
|
bool |
sort = true |
|
) |
| |
Perform fixed radius search. All query points share the same radius.
- Parameters
-
query_points | Data points for querying. Must be 2D, with shape {n, d}. |
radius | Radius. |
sort | Sort the results by distance. Default is True. |
- Returns
- Tuple of Tensors, (indices, distances, num_neighbors):
- indices: Tensor of shape {total_number_of_neighbors,}, with dtype same as index_dtype_.
- distances: Tensor of shape {total_number_of_neighbors,}, same dtype with query_points. The distances are squared L2 distances.
- num_neighbors: Tensor of shape {n+1,}, with dtype Int64. The Tensor is a prefix sum of the number of neighbors for each query point.
◆ HybridIndex()
bool open3d::core::nns::NearestNeighborSearch::HybridIndex |
( |
utility::optional< double > |
radius = {} | ) |
|
Set index for hybrid search.
- Returns
- Returns true if building index success, otherwise false.
◆ HybridSearch()
std::tuple< Tensor, Tensor, Tensor > open3d::core::nns::NearestNeighborSearch::HybridSearch |
( |
const Tensor & |
query_points, |
|
|
const double |
radius, |
|
|
const int |
max_knn |
|
) |
| const |
Perform hybrid search.
- Parameters
-
query_points | Data points for querying. Must be 2D, with shape {n, d}. |
radius | Radius. |
max_knn | Maximum number of neighbor to search per query. |
- Returns
- Tuple of Tensors, (indices, distances, counts):
- indices: Tensor of shape {n, knn}, with dtype same as index_dtype_.
- distances: Tensor of shape {n, knn}, with same dtype with query_points. The distances are squared L2 distances.
- counts: Counts of neighbour for each query points. [Tensor of shape {n}, with dtype same as index_dtype_].
◆ KnnIndex()
bool open3d::core::nns::NearestNeighborSearch::KnnIndex |
( |
| ) |
|
Set index for knn search.
- Returns
- Returns true if building index success, otherwise false.
◆ KnnSearch()
std::pair< Tensor, Tensor > open3d::core::nns::NearestNeighborSearch::KnnSearch |
( |
const Tensor & |
query_points, |
|
|
int |
knn |
|
) |
| |
Perform knn search.
- Parameters
-
query_points | Query points. Must be 2D, with shape {n, d}. |
knn | Number of neighbors to search per query point. |
- Returns
- Pair of Tensors, (indices, distances):
- indices: Tensor of shape {n, knn}, with dtype same as index_dtype_.
- distances: Tensor of shape {n, knn}, same dtype with query_points. The distances are squared L2 distances.
◆ MultiRadiusIndex()
bool open3d::core::nns::NearestNeighborSearch::MultiRadiusIndex |
( |
| ) |
|
Set index for multi-radius search.
- Returns
- Returns true if building index success, otherwise false.
◆ MultiRadiusSearch()
std::tuple< Tensor, Tensor, Tensor > open3d::core::nns::NearestNeighborSearch::MultiRadiusSearch |
( |
const Tensor & |
query_points, |
|
|
const Tensor & |
radii |
|
) |
| |
Perform multi-radius search. Each query point has an independent radius.
- Parameters
-
query_points | Query points. Must be 2D, with shape {n, d}. |
radii | Radii of query points. Each query point has one radius. Must be 1D, with shape {n,}. |
- Returns
- Tuple of Tensors, (indices,distances, num_neighbors):
- indices: Tensor of shape {total_number_of_neighbors,}, with dtype same as index_dtype_.
- distances: Tensor of shape {total_number_of_neighbors,}, same dtype with query_points. The distances are squared L2 distances.
- num_neighbors: Tensor of shape {n+1,}, with dtype Int64. The Tensor is a prefix sum of the number of neighbors for each query point.
◆ operator=()
◆ dataset_points_
const Tensor open3d::core::nns::NearestNeighborSearch::dataset_points_ |
|
protected |
◆ fixed_radius_index_
◆ index_dtype_
const Dtype open3d::core::nns::NearestNeighborSearch::index_dtype_ |
|
protected |
◆ knn_index_
std::unique_ptr<nns::KnnIndex> open3d::core::nns::NearestNeighborSearch::knn_index_ |
|
protected |
◆ nanoflann_index_
std::unique_ptr<NanoFlannIndex> open3d::core::nns::NearestNeighborSearch::nanoflann_index_ |
|
protected |
The documentation for this class was generated from the following files: