Naive nearest neighbor finder
[dst,nidx] = cv.batchDistance(src1, src2)
[...] = cv.batchDistance(..., 'OptionName', optionValue, ...)
Input
- src1 samples matrix of size N1-by-M, type either 'single' or 'uint8'
- src2 samples matrix of size N2-by-M, type either 'single' or 'uint8'
Output
- dst distance matrix (see description below).
- nidx zero-based indices of nearest neighbors (matrix of size N1-by-K).
Only computed if
K>0
, otherwise an empty matrix is returned.
Options
- DType default -1
- NormType Distance metric used. Default 'L2'
- K Number of nearest neighbors in to find. If
K=0
(the default),
the full pairwaise distance matrix is computed (of size N1-by-N2),
otherwise only distances to the K-nearest neighbors is returned
(matrix of size N1-by-K).
- Mask Not set by default.
- Update default 0.
- CrossCheck default false.
See http://en.wikipedia.org/wiki/Nearest_neighbor_search