matcher.cpu_outlier_detector — Finding outliers in both the keypoints and the matches

The matcher.cpu_outlier_detector module

New in version 0.1.0.

autocnet.matcher.cpu_outlier_detector.distance_ratio(edge, matches, ratio=0.8, single=False)[source]

Compute and return a mask for a matches dataframe using Lowe’s ratio test. If keypoints have a single Lowe (2004) [Lowe2004]

Parameters
  • ratio (float) – the ratio between the first and second-best match distances for each keypoint to use as a bound for marking the first keypoint as “good”. Default: 0.8

  • single (bool) – If True, points with only a single entry are included (True) in the result mask, else False.

Returns

mask – A Pandas DataFrame mask for the matches with those failing the ratio test set to False.

Return type

pd.dataframe

autocnet.matcher.cpu_outlier_detector.mirroring_test(matches)[source]

Compute and return a mask for the matches dataframe on each edge of the graph which will keep only entries in which there is both a source -> destination match and a destination -> source match.

Parameters

matches (dataframe) – the matches dataframe stored along the edge of the graph containing matched points with columns containing: matched image name, query index, train index, and descriptor distance

Returns

duplicates – Intended to mask the matches dataframe. Rows are True if the associated keypoint passes the mirroring test and false otherwise. That is, if 1->2, 2->1, both rows will be True, otherwise, they will be false. Keypoints with only one match will be False. Removes duplicate rows.

Return type

dataseries

autocnet.matcher.cpu_outlier_detector.self_neighbors(matches)[source]

Returns a pandas data series intended to be used as a mask. Each row is True if it is not matched to a point in the same image (good) and False if it is (bad.)

Parameters

matches (dataframe) – the matches dataframe stored along the edge of the graph containing matched points with columns containing: matched image name, query index, train index, and descriptor distance

Returns

Intended to mask the matches dataframe. True means the row is not matched to a point in the same image and false the row is.

Return type

dataseries

autocnet.matcher.cpu_outlier_detector.spatial_suppression(df, bounds, xkey='x', ykey='y', k=60, error_k=0.05, nsteps=250)[source]

Apply the spatial suppression algorithm over an arbitrary domain for all of the spatial data in the provided data frame.

Parameters
  • df (object) – Pandas data frame with coordinates

  • bounds (list) – In the form xmin, ymin, xmax, ymax

  • xkey (str) – The column name for the x coordinates

  • ykey (str) – The column name for the y coordinates

  • k (int) – The desired number of points after suppression

  • error_k (float) – The percentage of allowable error in the domain [0,1]

  • nsteps (int) – The granularity of the search. This controls the number of buckets in the x and y dimension. More granular search adds processing time, but can result in a more accurate solution.

Returns

  • mask (nd.array) – A boolean mask of the valid points

  • len(result) (int) – The numer of valud points