Skip to main content

poselib-gpu

Robust relative pose and absolute pose (PnP) for calibrated cameras, over batches of problems: the five-point solver and P3P inside LO-RANSAC, with non-linear refinement, ported from PoseLib, with hand-written GPU kernels for Metal and CUDA where a GPU is measured faster than the CPU.

Use PoseLib for real work. This project is a test bed for batching and GPU kernels, not a replacement for it. It adds nothing to PoseLib except speed: no new solvers, models or features, and only a subset of what PoseLib offers. The methods, and the credit for them, are PoseLib's (BSD-3-Clause, Copyright (c) 2020 Viktor Larsson; the notice ships in the package).

Install

One of three packages, all providing the module poselib_gpu:

Package Platforms Backends
poselib-gpu Linux x86_64, macOS arm64, Windows x86_64 CPU; Metal on macOS
poselib-gpu-cu12 Linux x86_64, Windows x86_64 CPU and CUDA, built with CUDA 12 (GPUs from Pascal, sm_60)
poselib-gpu-cu13 Linux x86_64, Windows x86_64 CPU and CUDA, built with CUDA 13 (GPUs from Turing, sm_75)
pip install poselib-gpu          # or poselib-gpu-cu12 / poselib-gpu-cu13

The CUDA packages link the CUDA runtime statically: they need only an NVIDIA driver that supports their CUDA version, and no CUDA toolkit. Install one package, not several.

Use

import numpy as np
import poselib_gpu as pg

ctx = pg.Context()                      # "auto": every problem starts on the CPU; those still
                                        # running move to the GPU where that is measured faster
cam = pg.Camera("PINHOLE", [fx, fy, cx, cy])

# Image pairs: one (m, 2) array of matched pixels per pair, in image a and in image b.
r = ctx.relative_pose([xy_a0, xy_a1], [xy_b0, xy_b1], cam, max_error_px=1.0)
r.pose        # (n, 7): qw qx qy qz tx ty tz, camera a to camera b, |t| = 1
r.n_inliers   # (n,)
r.inliers     # one boolean mask per pair
r.median_tri_angle_deg, r.status, r.iterations, r.score

# Images to register: pixels and their world points.
r = ctx.absolute_pose([xy0, xy1], [xyz0, xyz1], cam, max_error_px=4.0, min_inlier_ratio=0.25)
r.pose        # world to camera

Several cameras: pass a list and give each problem its index (camera_a, camera_b for pairs, camera for images). Cameras are COLMAP's models with COLMAP's parameter order: SIMPLE_PINHOLE, PINHOLE, SIMPLE_RADIAL, RADIAL, OPENCV, OPENCV_FISHEYE. A status of 0 (ok) only says a model was found: accept a pair or a registration by your own rule on n_inliers.

pg.Context("cpu"), "metal" or "cuda" picks a backend; pg.compiled_backends() lists the ones the package has, and pg.VARIANT, pg.CUDA_VERSION and pg.__version__ say which build it is. The auto rule was measured on an M5 Pro (Metal) and an RTX 2070 Max-Q (CUDA); on other GPUs it is a reasonable start, not a measurement.

Documentation, the C API and measurements: https://poselib-gpu.pages.dev and https://github.com/manlito/poselib-gpu.

Licence: Apache-2.0. The solvers are ported from PoseLib (BSD-3-Clause, Copyright (c) 2020 Viktor Larsson); its notice is in the package.

Metadata

Release files for poselib-gpu-cu12 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for poselib-gpu-cu12 0.1.0
File Interpreter ABI Platform Actions
poselib_gpu_cu12-0.1.0-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details for poselib_gpu_cu12-0.1.0-cp312-abi3-win_amd64.whl
poselib_gpu_cu12-0.1.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 abi3 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details for poselib_gpu_cu12-0.1.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Total release size: 2.6 MB

Release files / poselib_gpu_cu12-0.1.0-cp312-abi3-win_amd64.whl

Download URL poselib_gpu_cu12-0.1.0-cp312-abi3-win_amd64.whl
Size 1.3 MB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
e70a22840394861c3113f9fb73e28515d13d3a626a6d2dc256a3a854298899b8
BLAKE2b-256 checksum
How to use checksums
25363c90f8c75768b1a9db5fab5e76e65579e31be3133187d1e6c88fc11d488b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Release files / poselib_gpu_cu12-0.1.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL poselib_gpu_cu12-0.1.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 1.3 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
15dc0b17442fd0e6c86feaf69e8449321ac20919813ca043db6bf388f184d6c9
BLAKE2b-256 checksum
How to use checksums
d6f5b1d664f8bdbb8f77586c737b099e9c05a385f92af85e833bb9df4feb13df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Security for poselib-gpu-cu12 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for poselib_gpu_cu12-0.1.0-cp312-abi3-win_amd64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page