hamming_matcher
- arrayfire.hamming_matcher(query: Array, train: Array, /, axis: int = 0, n_nearest: int = 1) tuple[Array, Array]
Finds the nearest neighbors for each descriptor in a query set from a training set, based on the Hamming distance.
Parameters
- queryArray
The query set of feature descriptors as an ArrayFire array. Each descriptor should be a row in a 2D array or along the specified axis in higher dimensions.
- trainArray
The training set of feature descriptors as an ArrayFire array. This serves as the database from which the closest matches to the query descriptors are found.
- axisint, default=0
The dimension along which the feature descriptors are aligned. Typically, descriptors are arranged as rows in a 2D array (axis=0).
- n_nearestint, default=1
The number of nearest neighbors to find for each query descriptor. Setting n_nearest greater than 1 enables finding multiple close matches.
Returns
- tuple[Array, Array]
A tuple containing two ArrayFire arrays: - The first array contains the indices of the closest matches in the training set for each query descriptor. - The second array contains the Hamming distances of these matches.
Note
The Hamming matcher is particularly effective for binary feature descriptors and is widely used in computer vision tasks such as object recognition and tracking. When using n_nearest > 1, the function returns multiple matches per query descriptor, which can be useful for robust matching strategies.