Circle Fitting
The 2D circle is one more model of the RANSAC family: CircleProblem is the MinimalSolveProblem of a Circle{Float64} through one image's points. The circle supplies only what a model supplies, all of it VisualGeometryToolkitCore's — the minimal solver Circle3pt (the circumcircle of three points), the point-on-circle constraint constraint_with_jacobians(c, x) with g = ‖x − c‖² − r², and the chart CircleManifold (the centre and log r). The residual is the family's Sampson distance g/‖∂g/∂x‖ = (d² − r²)/(2d), the geometric distance d − r to first order, in the points' units (pixels). find_circle is its RANSAC, with the robustified LM (Triggs) as its local optimization.
VisualGeometryToolkitEstimation.CircleProblem — Type
CircleProblemThe RANSAC problem of a 2D circle through points: the MinimalSolveProblem whose model is a Circle{Float64} (GeometryBasics', re-exported by VisualGeometryToolkitCore). Minimal sample 3 (VisualGeometryToolkitCore's Circle3pt), codimension 1 (the Sampson distance of ‖x − c‖² − r², in the points' units), a 3-dof chart (VisualGeometryToolkitCore's CircleManifold: the centre and log r). Build it with CircleProblem(points); the public estimator is find_circle.
VisualGeometryToolkitEstimation.find_circle — Function
find_circle(points; scoring,
max_trials, min_trials,
local_optimization_strategy, config = nothing)Robust estimation of a 2D circle through points (a contour, edge points) by RANSAC on the CircleProblem: 3-point samples (VisualGeometryToolkitCore's Circle3pt, the circumcircle), MSAC scoring of the Sampson distance of ‖x − c‖² − r² — the geometric distance to the circle to first order — and, as local optimization, the robustified LM (Triggs) on the centre and log radius: one Levenberg–Marquardt solve from the hypothesis over all the points under the Welsch loss at efficiency_constant·ŝ, ŝ the Student-t scale of the hypothesis's Sampson errors. Every default is configs/default.toml's ([ransac], [pipelines.circle]); a keyword overrides.
Returns a RansacEstimate (its estimate a Circle{Float64}), the :no_model result (iterations 0) for fewer than 3 points. iterations(result) is the number of trials (hypotheses drawn); test found_model(result) before reading the model (see RansacEstimate).
Arguments
points: 2D points,AbstractVectorofStaticVector{2}(Point2{Float64}storage canonicalized internally), plain: unit isotropic noise.scoring: the scorer, its width in PIXELS (the points' unit), asfind_homography; default[pipelines.circle] scoring.workspace: asfind_homography, built withRansacWorkspace([T,] CircleProblem, n_data).local_optimization_strategy: default[pipelines.circle] local_optimization_strategy; any other strategy asfind_homography.- the other keywords as
find_homography.
VisualGeometryToolkitEstimation.refine_circle — Function
refine_circle(circle, points; optimization_strategy, scale | width, workspace = nothing)
-> FitResult{M, RefineMetadata}The 2D circle through points refined from the given circle (the points' distances to it, pixels; codimension 1): the keywords, the result and the refusals are those of every refine_*, documented on refine_homography (default strategy: [refine.circle] optimization_strategy). Fewer than 3 points: the guess back unrefined, record (ReturnCode.InitialFailure, NoRule) (retcode_symbol:degenerate).