FixTheRobot Explore Robotics / Perception / P4 / P4-L3

This lab works on phones, but writing code is much easier on a laptop.

Perception · Classical Feature Detection and Matching · P4-L3 · Advanced

Reject Incorrect Correspondences and Measure the Improvement

A feature matcher gives 40 matches between two views. About half of them are wrong, and a robot that fits a transform to all of them gets an answer that is wrong by pixels.

You will see how RANSAC finds the transform that most matches agree on, write the loop, and then use the matches it trusts to get an accurate answer.

Your task

    Simulation
    solution.pyLoading Python…
    Ctrl+Enter runs
    What Python can I use?

    Plain Python with math (and slamkit for small matrix helpers: matmul, transpose, solve, inverse, identity). Images, point clouds and detections arrive as lists inside the dictionary D; an image is a list of rows, each row a list of pixels. There is no NumPy or OpenCV: you write the algorithm yourself, which is the point of the lab. Print with print().

    Hints

    What this lab teaches

    Stage 1 is an experiment on RANSAC’s two parameters. Stage 2 writes the RANSAC loop. Stage 3 refits the transform on all inliers and shows the gain over using every match. Your code is graded on hidden match sets; the simulator keeps the true transform and the identity of the wrong matches private.

    Theory for this lab

    Classical Feature Detection and Matching labs

    1. P4-L1: Detect Image Features
    2. P4-L2: Match Features Between Images
    3. P4-L3: Reject Incorrect Correspondences and Measure the Improvement: this lab.

    Educational simplification: simulated correspondences between two 64 by 48 frames related by a rotation and a shift (a similarity with scale 1), 40 matches with 0.5 pixel Gaussian noise and 30 to 50% random outliers; the random samples for RANSAC are drawn for you so that runs are reproducible. Real matches relate through a homography or the epipolar geometry and have structured outliers. All data in this lab are simulated.

    Get the next lab

    Get notified when new robotics labs are released. One email per new lab, nothing else.