[Feature]: Explore RANSAC variants for two view pose estimation
#713 opened on Feb 16, 2026
Repository metrics
- Stars
- (675 stars)
- PR merge metrics
- (PR metrics pending)
Description
🚀 Feature Description
Add support for advanced RANSAC variants in the kornia-3d pose estimation module, specifically:
-
LO-RANSAC (Locally Optimized RANSAC): Performs local optimization on promising hypotheses to improve model quality before final selection.
-
GC-RANSAC (Graph-Cut RANSAC): Uses graph-cut optimization for spatial consistency in inlier selection, improving robustness in structured scenes.
-
PROSAC (Progressive Sample Consensus): Leverages match quality scores for more efficient sampling, reducing iterations needed for convergence.
These variants would enhance the existing ransac_fundamental and ransac_homography functions in kornia-3d/src/pose/twoview.rs, as well as the PnP RANSAC in kornia-3d/src/pnp/ransac.rs.
📂 Feature Category
Geometry
💡 Motivation
The current RANSAC implementation in kornia-3d uses a basic vanilla RANSAC approach. While functional, this has limitations:
-
Efficiency: Vanilla RANSAC may require many iterations to find a good model, especially with high outlier ratios.
-
Model Quality: Without local optimization, the final model may not be as refined as it could be.
-
Spatial Consistency: Vanilla RANSAC treats points independently, missing opportunities to leverage spatial structure.
As discussed by @ducha-aiki in PR #688:
"yes - LO-RANSAC, GC-RANSAC. Overall I'd mimic https://github.com/PoseLib/PoseLib"
💭 Proposed Solution
1. Extend RansacParams Configuration
Add configuration options to support different RANSAC strategies:
/// RANSAC method variants
#[derive(Clone, Copy, Debug, Default)]
pub enum RansacMethod {
/// Standard RANSAC (current implementation)
#[default]
Standard,
/// Locally Optimized RANSAC - refines promising hypotheses
LoRansac {
/// Number of local optimization iterations
lo_iterations: usize,
/// Inlier threshold multiplier for LO step
lo_threshold_mult: f64,
},
/// Graph-Cut RANSAC - spatial consistency via graph cuts
GcRansac {
/// Neighborhood radius for graph construction
neighborhood_radius: f64,
/// Spatial coherence weight
spatial_weight: f64,
},
/// Progressive RANSAC - quality-guided sampling
Prosac {
/// Maximum PROSAC-specific iterations before falling back to uniform sampling
max_prosac_iterations: usize,
},
}
#[derive(Clone, Debug)]
pub struct RansacParams {
/// Maximum number of RANSAC iterations
pub max_iterations: usize,
/// Minimum number of iterations before early termination
pub min_iterations: usize,
/// Inlier threshold (pixel error)
pub threshold: f64,
/// Minimum number of inliers required for acceptance
pub min_inliers: usize,
/// Target success probability for adaptive iteration count
pub confidence: f64,
/// RANSAC method variant
pub method: RansacMethod,
/// Optional RNG seed for deterministic runs
pub random_seed: Option<u64>,
}
📚 Library Reference
PoseLib (C++): https://github.com/PoseLib/PoseLib
🔄 Alternatives Considered
No response
🎯 Use Cases
-
Visual SLAM Initialization: Two-view initialization with robust pose recovery from potentially noisy feature matches
-
Structure from Motion: Essential/fundamental matrix estimation in SfM pipelines with varying outlier ratios
📝 Additional Context
No response
🤝 Contribution Intent
- I plan to submit a PR to implement this feature
- I'm requesting this feature but not planning to implement it