If you have ever written a Python script to detect cards with OpenCV, you probably called cv2.findHomography(..., cv2.RANSAC).
And if you tested it on 50 real photos taken under varying bedroom lighting, you noticed something frustrating: card corners randomly shift by 1 to 4 pixels from one shot to another.
The Fatal Flaw of 1981 RANSAC
Standard RANSAC (Fischler & Bolles, 1981) relies on a binary cutoff: a candidate point is either an "inlier" (distance < threshold $\sigma$) or an "outlier" (distance ≥ $\sigma$).
- If you set the threshold to $3.0\text{ px}$, slight soft focus or shadow fuzziness causes edge points to jump between inlier and outlier status.
- This causes "corner jitter" — the rectified card breathes by 0.5% in dimensions, throwing off centering precision.
"By marginalizing over the noise scale instead of applying an arbitrary hard inlier threshold, MAGSAC++ achieves geometrically optimal parameter estimates with high speed and zero manual tuning."
The CVPR 2020 Breakthrough: Marginalization
In 2020, researchers from ETH Zurich and Czech Technical University introduced MAGSAC++. Instead of guessing a single magic threshold, the algorithm integrates over the entire probability density of noise scales $\sigma$:
Points close to the true card edge contribute with maximal weight, while distant dust motes or textured table runners are smoothly discounted.
GradieQ implements MAGSAC++ for outer boundary and corner homography. That is why our geometric rectification is rock-solid: whether your desk is wood, fabric, or marble, the card is mapped to canonical $63 \times 88\text{ mm}$ space with zero artificial corner jitter.