matcher.cpu_matcher — CPU Based n-Keypoint Matcher

The matcher.cpu_matcher module

New in version 0.1.0.

class autocnet.matcher.cpu_matcher.FlannMatcher(flann_parameters={'algorithm': 1, 'trees': 3})[source]

A wrapper to the OpenCV Flann based matcher class that adds metadata tracking attributes and methods. This takes arbitrary descriptors and so should be available for use with any descriptor data stored as an ndarray.

image_indices

with key equal to the train image index (returned by the DMatch object), e.g. an integer array index and value equal to the image identifier, e.g. the name

Type

dict

image_index_counter

The current number of images loaded into the matcher

Type

int

add(descriptor, nid, index=None)[source]

Add a set of descriptors to the matcher and add the image index key to the image_indices attribute

Parameters
  • descriptor (ndarray) – The descriptor to be added

  • nid (int) – The node ids

clear()[source]

Remove all nodes from the tree and resets all counters

query(descriptor, query_image, k=3, index=None)[source]
Parameters
  • descriptor (ndarray) – The query descriptor to search for

  • query_image (hashable) – Key of the query image

  • k (int) – The number of nearest neighbors to search for

  • index (iterable) – An iterable of observation indices to utilize for the input descriptors

Returns

matched – containing matched points with columns containing: matched image name, query index, train index, and descriptor distance

Return type

dataframe

train()[source]

Using the descriptors, generate the KDTree

autocnet.matcher.cpu_matcher.match(edge, k=2, **kwargs)[source]

Given two sets of descriptors, utilize a FLANN (Approximate Nearest Neighbor KDTree) matcher to find the k nearest matches. Nearness is the euclidean distance between descriptors.

The matches are then added as an attribute to the edge object.

Parameters

k (int) – The number of neighbors to find