🎮 Simulator EP08_02: RANSAC — Inlier Count
Model: Scale ×2
The candidate model maps (x,y) → to (2x,2y). Adjust the threshold ε and see which correspondences become inliers or outliers.
–
RANSAC, introduced in the section “Mathematical Modeling: Homography and RANSAC,” repeats a cycle of three steps — sampling a minimal set, estimating a candidate model, and counting how many correspondences are consistent with it (the inliers) — keeping at the end the most voted model. The model estimation step from 4 points (step 2) involves linear algebra that is beyond the scope of this assignment; here, you are directly given a set of already candidate homographies — as if each one had been estimated from a different random sample — and you are tasked with reproducing exactly the algorithm’s decisive step: apply each model to all correspondences and count its inliers, choosing the winner.
Modelo k: I inliers. Finally, print Melhor modelo: k_best com I_best inliers.| Element | Role in RANSAC |
|---|---|
| Minimal sample (4 pairs) | Sufficient to determine the 8 degrees of freedom of a homography |
| Candidate model \(H_k\) | Estimated from a minimal sample; can be good or bad, depending on whether the sample contained outliers |
| Reprojection error | Measures how well the model “predicts” each observed correspondence |
| Inlier vs. outlier | Correspondences consistent with the winning model (inliers) vs. the remaining ones, typically incorrect matches from the matching step |
| Final refinement | In practice, after selecting the best model, RANSAC recomputes it using only its inliers — a step not required in this assignment |
Input:
Output:
Modelo k: I inliers.Melhor modelo: k_best com I_best inliers.| Input | Output | Observation |
|---|---|---|
| 5 0 0 0 0 1 1 2 2 2 0 4 0 0 2 0 4 5 5 1 1 2 0.5 2 0 0 0 2 0 0 0 1 1 0 0 0 1 0 0 0 1 |
Modelo 0: 4 inliers Modelo 1: 1 inliers Melhor modelo: 0 com 4 inliers |
Model 0 (scale ×2) correctly explains 4 of the 5 correspondences; the 5th, \((5,5)\to(1,1)\), is an outlier that neither model explains well. |
%%writefile EP08_02.py
# Python codeOverwriting EP08_02.py
TestSuite("EP08_02.py").run()✔️ EP08_02.cases already exists in casos/
📋 6 case(s) loaded from casos/EP08_02.cases
🔍 Testing Python: EP08_02.py
⚠️ EP08_02.py: Empty file (fewer than 3 lines). Tests skipped.