#computer-vision #pose #cv

sqpnp

A pure Rust implementation of the SQPnP perspective-n-point algorithm

4 releases (breaking)

0.4.0 Feb 25, 2026
0.3.0 Sep 11, 2025
0.2.0 Jan 27, 2025
0.1.0 Jan 18, 2025

#1455 in Algorithms

Download history 321/week @ 2026-02-24 424/week @ 2026-03-03 346/week @ 2026-03-10 154/week @ 2026-03-17 472/week @ 2026-03-24 414/week @ 2026-03-31 413/week @ 2026-04-07 553/week @ 2026-04-14 666/week @ 2026-04-21 456/week @ 2026-04-28 350/week @ 2026-05-05 499/week @ 2026-05-12 340/week @ 2026-05-19 582/week @ 2026-05-26 1204/week @ 2026-06-02 712/week @ 2026-06-09

2,924 downloads per month

MIT/Apache

43KB
1K SLoC

Implementation of SQPnP perspective-n-point algorithm.

This can be used to determine the pose of a 3D object given two sets of corresponding points: a set of 3D points from the object and a set of 2D projected points (often from an image).

See the C++ implementation for more information about SQPnP: terzakig/sqpnp.


sqpnp-rs

crate

sqpnp-rs is a pure Rust implementation of the SQPnP perspective-n-point algorithm, based on the C++ implementation.

Usage

let p3d = [
    // 3D object points
    vec3(1.0, 1.0, 1.0),
];
let p2d = [
    // projected points
    vec2(-0.5, -0.5),
];

let mut solver = Solver::<DefaultParameters>::new();
if (solver.solve(&p3d, &p2d, None)) {
    let solution = solver.best_solution().unwrap();
    let r = solution.rotation_matrix();
    let t = solution.translation();

    // ...
}

See Also

There is another pure-Rust implementation of SQPnP, here: powei-lin/sqpnp_simple.

License

sqpnp-rs is permissively licensed under either the MIT License or the Apache 2.0 License.

Dependencies

~8.5MB
~249K SLoC