Table of Contents

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

features InputArray

features – Matrix of type CV _ 32F containing the features(points) to index. The size of the matrix is num _ features x feature _ dimensionality.

params IndexParams

Structure containing the index parameters. The type of index that will be constructed depends on the type of this parameter.

distType FlannDistance

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

queries Mat

The query points, one per row

indices Mat

Indices of the nearest neighbors found

dists Mat

Distances to the nearest neighbors found

knn int

Number of nearest neighbors to search for

params SearchParams

Search 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

queries Mat

The query points, one per row

indices int[]

Indices of the nearest neighbors found

dists float[]

Distances to the nearest neighbors found

knn int

Number of nearest neighbors to search for

params SearchParams

Search 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

queries float[]

The query points, one per row

indices int[]

Indices of the nearest neighbors found

dists float[]

Distances to the nearest neighbors found

knn int

Number of nearest neighbors to search for

params SearchParams

Search 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

queries Mat

The query point

indices Mat

Indices of the nearest neighbors found

dists Mat

Distances to the nearest neighbors found

radius double

Number of nearest neighbors to search for

maxResults int
params SearchParams

Search 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

queries Mat

The query point

indices int[]

Indices of the nearest neighbors found

dists float[]

Distances to the nearest neighbors found

radius double

Number of nearest neighbors to search for

maxResults int
params SearchParams

Search 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

queries float[]

The query point

indices int[]

Indices of the nearest neighbors found

dists float[]

Distances to the nearest neighbors found

radius double

Number of nearest neighbors to search for

maxResults int
params SearchParams

Search parameters

Save(string)

Saves the index to a file.

public void Save(string filename)

Parameters

filename string

The file to save the index to