PIXELBANKv9.1.0
Menu

You are given point correspondences and a translation model, and need to determine which correspondences are inliers.

A correspondence ((x1, y1), (x2, y2)) is an inlier if the predicted point matches the actual target point within a threshold:

error=(x1+tx−x2)2+(y1+ty−y2)2\text{error} = \sqrt{(x_1 + t_x - x_2)^2 + (y_1 + t_y - y_2)^2}

If error < threshold, the correspondence is an inlier.

The inlier mask is used to:

  1. Count support for a model hypothesis
  2. Refine the model using only inliers
  3. Identify and remove outlier correspondences

Example:

Input:
correspondences = [((0,0), (1,1)), ((0,0), (5,5))]
transform = (1, 1)
threshold = 0.5
Output:
[True, False]
Reasoning:

Testing each correspondence against the translation (1, 1):

Correspondence 1: (0,0) → (1,1)

  • Predicted: (0+1, 0+1) = (1, 1)
  • Actual: (1, 1)
  • Error = √((1-1)² + (1-1)²) = 0.0
  • 0.0 < 0.5 → INLIER

Correspondence 2: (0,0) → (5,5)

  • Predicted: (0+1, 0+1) = (1, 1)
  • Actual: (5, 5)
  • Error = √((1-5)² + (1-5)²) = √32 ≈ 5.66
  • 5.66 >= 0.5 → OUTLIER

Result: [True, False]

Constraints:

  • correspondences: list of ((x1,y1), (x2,y2)) pairs
  • transform: (tx, ty) translation vector
  • threshold: maximum Euclidean distance for inlier classification
  • Return list of boolean values (True for inliers)
🔒

Editor locked

The code editor is locked for Pro problems. It is only available for free problems. Please upgrade to gain access to the code editor for all problems.

solution.py

Test Results

0/0
Run code to see test results.
Compute Inlier Mask - Medium | PixelBank