Skip to main content

Alitra

Library for ALIgnment and TRAnsformation between fixed coordinate frames. The transform is described by a translation and a homogeneous rotation.

Developed for transforming between the fixed local coordinate-frame and the asset-fixed coordinate-frame.

Installation

Installation from pip

pip install alitra
import alitra
help(alitra)

Image alignment (see Image alignment below) requires the optional image-alignment extra:

pip install alitra[image-alignment]

Installation from source

git clone https://github.com/equinor/alitra
cd alitra
uv sync --extra dev

You can test whether installation was successful with pytest

uv run pytest

Dependencies

The dependencies used for this package are listed in pyproject.toml and pinned in uv.lock. This ensures our builds are predictable and deterministic. This project uses uv for dependency management:

uv lock

To update the dependencies to the latest versions, run:

uv lock --upgrade

Image alignment

When two photos of the same scene are taken at different times, small differences in camera position mean a region-of-interest (ROI) polygon drawn on one photo no longer lines up with the same spot in the other. Alitra provides two functions to re-align a reference photo (and its ROI polygon) to a new source photo, so the polygon can be reused without redrawing it:

  • align_two_images_translation_cv2: estimates a simple (dx, dy) pixel shift using phase correlation. Fast and robust, but only correct when the camera hasn't rotated or changed perspective between the two photos (e.g. a fixed camera with minor positional drift).
  • align_two_images_orb_bf_cv2: detects ORB keypoints and estimates a full homography (rotation, scale and perspective change included). Handles a moved/rotated camera, but needs enough distinct visual features to match between the two photos.

Both functions return the ROI polygon transformed into the new photo's coordinates. If the transformed polygon has no overlap with the new photo at all, None is returned instead. If it partially overlaps, the returned coordinates are clamped to valid pixel indices.

Contributing

We welcome all kinds of contributions, including code, bug reports, issues, feature requests, and documentation. The preferred way of submitting a contribution is to either make an issue on GitHub or by forking the project on GitHub and making a pull request.

How to use

The tests in this repository can be used as examples of how to use the different models and functions. The test_example.py is a good place to start.

Release files for alitra 3.0.2

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

Source distribution (sdist)

Source distribution for alitra 3.0.2
File Size Uploaded
alitra-3.0.2.tar.gz 55.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for alitra 3.0.2
File Interpreter ABI Platform
alitra-3.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 72.3 kB

Release files / alitra-3.0.2.tar.gz

Download URL alitra-3.0.2.tar.gz
Size 55.2 kB
Tags Source
SHA-256 checksum
How to use checksums
269f59c42c464d343667ec743ed57fb373be9519ca5d3aa85c56542901349eef
BLAKE2b-256 checksum
How to use checksums
d373e9422e74e2095b4c222867c4293821981837c0e3ab731615064fcd439503
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / alitra-3.0.2-py3-none-any.whl

Download URL alitra-3.0.2-py3-none-any.whl
Size 17.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e3724996ba815766b412ca87294904402182634bf9d00b87514ead014da208a0
BLAKE2b-256 checksum
How to use checksums
0d419e7be130fa494c7143237c941396d9933c4099d28a3056ee4483f1307b8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

3.0.2 This release

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.0.0

2 release files

1.1.5

2 release files

1.1.3

2 release files

1.1.0

2 release files

1.0.16

2 release files

1.0.11

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.6

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.0

2 release files

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