Skip to main content

estimate_similarity

Function estimate_similarity 

Source
pub fn estimate_similarity(
    src: &[(f32, f32); 5],
    dst: &[(f32, f32); 5],
) -> Option<SimilarityTransform>
Expand description

Least-squares similarity transform from source -> target (both 5 points).

Solves for (a, b, tx, ty) such that: target_x = asrc_x - bsrc_y + tx target_y = bsrc_x + asrc_y + ty

Closed-form via centering and normal equations. Returns None if the source points are degenerate (zero spread).