Class Index
- Namespace
- OpenCvSharp.Flann
- Assembly
- OpenCvSharp.dll
The FLANN nearest neighbor index class.
public class Index : DisposableCvObject, IDisposable, ICvPtrHolder
- Inheritance
-
Index
- Implements
- Inherited Members
Constructors
Index(InputArray, IndexParams, FlannDistance)
Constructs a nearest neighbor search index for a given dataset.
public Index(InputArray features, IndexParams @params, FlannDistance distType = FlannDistance.Euclidean)
Parameters
featuresInputArrayfeatures – Matrix of type CV _ 32F containing the features(points) to index. The size of the matrix is num _ features x feature _ dimensionality.
paramsIndexParamsStructure containing the index parameters. The type of index that will be constructed depends on the type of this parameter.
distTypeFlannDistance
Methods
DisposeUnmanaged()
Releases unmanaged resources
protected override void DisposeUnmanaged()
KnnSearch(Mat, Mat, Mat, int, SearchParams)
Performs a K-nearest neighbor search for multiple query points.
public void KnnSearch(Mat queries, Mat indices, Mat dists, int knn, SearchParams @params)
Parameters
queriesMatThe query points, one per row
indicesMatIndices of the nearest neighbors found
distsMatDistances to the nearest neighbors found
knnintNumber of nearest neighbors to search for
paramsSearchParamsSearch parameters
KnnSearch(Mat, out int[], out float[], int, SearchParams)
Performs a K-nearest neighbor search for multiple query points.
public void KnnSearch(Mat queries, out int[] indices, out float[] dists, int knn, SearchParams @params)
Parameters
queriesMatThe query points, one per row
indicesint[]Indices of the nearest neighbors found
distsfloat[]Distances to the nearest neighbors found
knnintNumber of nearest neighbors to search for
paramsSearchParamsSearch parameters
KnnSearch(float[], out int[], out float[], int, SearchParams)
Performs a K-nearest neighbor search for multiple query points.
public void KnnSearch(float[] queries, out int[] indices, out float[] dists, int knn, SearchParams @params)
Parameters
queriesfloat[]The query points, one per row
indicesint[]Indices of the nearest neighbors found
distsfloat[]Distances to the nearest neighbors found
knnintNumber of nearest neighbors to search for
paramsSearchParamsSearch parameters
RadiusSearch(Mat, Mat, Mat, double, int, SearchParams)
Performs a radius nearest neighbor search for a given query point.
public void RadiusSearch(Mat queries, Mat indices, Mat dists, double radius, int maxResults, SearchParams @params)
Parameters
queriesMatThe query point
indicesMatIndices of the nearest neighbors found
distsMatDistances to the nearest neighbors found
radiusdoubleNumber of nearest neighbors to search for
maxResultsintparamsSearchParamsSearch parameters
RadiusSearch(Mat, int[], float[], double, int, SearchParams)
Performs a radius nearest neighbor search for a given query point.
public void RadiusSearch(Mat queries, int[] indices, float[] dists, double radius, int maxResults, SearchParams @params)
Parameters
queriesMatThe query point
indicesint[]Indices of the nearest neighbors found
distsfloat[]Distances to the nearest neighbors found
radiusdoubleNumber of nearest neighbors to search for
maxResultsintparamsSearchParamsSearch parameters
RadiusSearch(float[], int[], float[], double, int, SearchParams)
Performs a radius nearest neighbor search for a given query point.
public void RadiusSearch(float[] queries, int[] indices, float[] dists, double radius, int maxResults, SearchParams @params)
Parameters
queriesfloat[]The query point
indicesint[]Indices of the nearest neighbors found
distsfloat[]Distances to the nearest neighbors found
radiusdoubleNumber of nearest neighbors to search for
maxResultsintparamsSearchParamsSearch parameters
Save(string)
Saves the index to a file.
public void Save(string filename)
Parameters
filenamestringThe file to save the index to