Model-fitting API

The Experimental panorai.model_fitting namespace separates geometric model families from robust sampling and scoring. It is not coupled to the stitching Application.

Reusable robust model fitting for geometric computer vision.

The module is intentionally independent from stitching. A model family owns its minimal solver and residual definition; robust_fit() owns sampling, MSAC/RANSAC scoring, deterministic tie breaking and local refitting.

class panorai.model_fitting.ModelFamily(*args, **kwargs)

Minimal public contract consumed by robust_fit().

Residuals must be finite, non-negative and expressed in the same unit as RobustFitOptions.residual_threshold. Implementations may return None from fit for a degenerate sample.

fit(*observations)

Fit one model to aligned observation arrays.

residuals(model, *observations)

Return one residual for each observation row.

class panorai.model_fitting.RobustFitOptions(residual_threshold, method='msac', confidence=0.999, min_trials=32, max_trials=1000, local_optimization_steps=3, min_inliers=None, random_seed=0)

Configuration shared by deterministic RANSAC and MSAC.

class panorai.model_fitting.RobustFitResult(model, inlier_mask, residuals, score, num_trials, num_degenerate_samples, model_family, residual_unit, method, interface='panorai-robust-model-fitting/v1-experimental', stability='experimental')

Immutable model, consensus and diagnostics from robust fitting.

panorai.model_fitting.robust_fit(family, *observations, options)

Fit family with deterministic RANSAC/MSAC and local refitting.

class panorai.model_fitting.RotationModel(name='rotation', min_samples=3, residual_unit='radians')

Wahba/Kabsch model mapping source bearings into target bearings.

panorai.model_fitting.fit_rotation(source_bearings, target_bearings, *, max_angular_error_deg=1.0, options=None)

Robustly estimate one target-from-source SO(3) rotation.

class panorai.model_fitting.HomographyModel(name='homography', min_samples=4, residual_unit='pixels')

Normalized-DLT planar homography with symmetric transfer residuals.

panorai.model_fitting.fit_homography(source_pixels_xy, target_pixels_xy, *, max_transfer_error_px=3.0, options=None)

Robustly estimate a normalized-DLT planar homography.

RANSAC and MSAC use the same full-set residuals and deterministic seed. A ModelFamily must declare the residual unit; thresholds are never silently converted between pixels, radians or another domain.

See the estimator catalog and the stitching guide.