transformation.homography — Homographies

The transformation.homography module contains functions for computing a planar homography between two images and assessing reprojective error. We do not generally suggest using these methods unless the user is confident that the images are planar. In testing with planetary data, systematic error occurs due to topography even at long viewing distances.

New in version 0.1.0.

autocnet.transformation.homography.compute_error(H, x, x1)[source]

Give this homography, compute the planar reprojection error between points a and b. x and x1 can be n, 2 or n,3 homogeneous coordinates. If only x, y coordinates, assume that z=1, e.g. x, y, 1 for all coordiantes.

Parameters
  • x (ndarray) – n,2 array of x,y coordinates

  • x1 (ndarray) – n,2 array of x,y coordinates

Returns

df – With columns for x_residual, y_residual, rmse, and error contribution. The dataframe also has cumulative x, t, and total RMS statistics accessible via df.x_rms, df.y_rms, and df.total_rms, respectively.

Return type

dataframe

autocnet.transformation.homography.compute_homography(x1, x2, method='ransac', reproj_threshold=2.0)[source]

Compute a planar homography given two sets of keypoints

Parameters
  • x1 (ndarray) – (n, 2) of coordinates from the source image

  • x2 (ndarray) – (n, 2) of coordinates from the destination image

  • method ({'ransac', 'lmeds', 'normal'}) – The openCV algorithm to use for outlier detection

  • reproj_threshold (float) – The maximum distances in pixels a reprojected points can be from the epipolar line to be considered an inlier

Returns

  • H (ndarray) – (3,3) homography

  • mask (ndarray) – Boolean mask for those values omitted from the homography.