Fourier-Mellin Python Library using OpenCV
This repository implements the Fourier-Mellin transform for image registration and video stabilization using semilog polar coordinates with OpenCV. The implementation is written in C++, but python bindings are provided. For information about the pipeline, see this article. Tested on Ubuntu 20.04.
Disclaimer
This repository is an unstable release and not intended for production. Many other repositories have implemented the Fourier-Mellin transform, for example imreg_fmt by sthoduka or fourier-mellin by polakluk.
Note that the image registration only works effectively for Eucledian/similar transformations without affine or perspective distortions.
Video Stabilization
https://github.com/brht0/fourier-mellin/assets/90235713/c5524042-6bc6-46b5-837e-adb62ddcf9b1
Original video can be found on Youtube (No affiliation)
Image Registration
Image registration with a transformed image, overlayed.
Installation with git clone
It is recommended to use a python virtual environment. The repository will be added to PyPI in time.
# inside your own project
python3 -m venv .venv
source .venv/bin/activate
pip install git+https://github.com/brht0/fourier-mellin
Examples
Many examples, such as video stabilization, are included inside the examples/ subdirectory. The following example registers two images.
import cv2
import numpy as np
import fourier_mellin
reference = cv2.imread('lenna.png')
transformed = cv2.imread('lenna_transformed.png')
rows, cols = reference.shape[:2]
fm = fourier_mellin.FourierMellin(cols, rows)
transformed_reference, transform = fm.register_image(reference, transformed)
overlay = cv2.addWeighted(transformed, 0.5, transformed_reference, 0.5, 0.0, dtype=cv2.CV_32F)
cv2.imwrite("overlay.jpg", overlay)
cv2.imwrite("transformed.jpg", transformed)
Building without pip
Building without pip is not required for use with python. Building without pip requires installing additional dependencies, such as pybind11. This step may be skipped, in case only python bindings are used.
cmake -B build/release -S . -DCMAKE_BUILD_TYPE=Release
cmake --build build/release -j 8
Todo
- Register images directly from files
- Benchmarking
- Optimization
- CUDA with OpenCV
- remove filters, as cv::phaseCorrelate already applies Hanning Window
- Documentation
- Proper threading support
- angles beyond -90 to 90 deg
- updated readme with up to date information
- pure python version that for windows/macos
- memory problem when passing in reference to some functions, where image is replaced (clearer documentation?)
- link time optimizer flto
Metadata
Release files for fourier-mellin 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fourier_mellin-0.2.0.tar.gz | 4.6 kB | Without provenance | Details for fourier_mellin-0.2.0.tar.gz |
Built distributions (wheels)
Total release size: 387.3 MB
Release files / fourier_mellin-0.2.0.tar.gz
| Download URL | fourier_mellin-0.2.0.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
104e2829c7f4c6499493913b13bf23d9e839826ae7e211eb6334fae308619d0b
|
|
BLAKE2b-256 checksum How to use checksums |
fa538b0a1801b4823d4ecb705cd2f660023b26884ddd0190b65aeb260e604155
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / fourier_mellin-0.2.0-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | fourier_mellin-0.2.0-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 32.3 MB |
| Tags | Linux glibc 2.17+ x86-64 PyPy 3.11 PyPy 3.11 7.3 |
|
SHA-256 checksum How to use checksums |
33899a759bc860d97c7803d76758cca9c6516b99fb2990700cf8ec4bf6b3ac8d
|
|
BLAKE2b-256 checksum How to use checksums |
2bcb63e0b660fea1665a383e47039c3c34a71efd6b50a329cd7c55ced421072d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / fourier_mellin-0.2.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | fourier_mellin-0.2.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 32.3 MB |
| Tags | Linux glibc 2.17+ x86-64 PyPy 3.10 PyPy 3.10 7.3 |
|
SHA-256 checksum How to use checksums |
3bbd44574d26a0484991dfd6f741166241621b55d4438241efb5115f1316b6d5
|
|
BLAKE2b-256 checksum How to use checksums |
b74f31910fa058de7254d5f469c7d4345892a6b45ac5076bf99a6e68721a480e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / fourier_mellin-0.2.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | fourier_mellin-0.2.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 32.3 MB |
| Tags | Linux glibc 2.17+ x86-64 PyPy 3.9 PyPy 3.9 7.3 |
|
SHA-256 checksum How to use checksums |
a6ae523e82c9cebda020c10829763a3126e91e341e679b8b1e9cdcbf9c32acf5
|
|
BLAKE2b-256 checksum How to use checksums |
acfd4dfeb17ac3830011586b4ee372b472f59111048c447685a2735ffe959e91
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / fourier_mellin-0.2.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | fourier_mellin-0.2.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 32.3 MB |
| Tags | Linux glibc 2.17+ x86-64 PyPy 3.8 PyPy 3.8 7.3 |
|
SHA-256 checksum How to use checksums |
fc73bee6eeb0bd89d899c669b93a73ac9cf2f5cc021c542ff53e35f8de7ac8b8
|
|
BLAKE2b-256 checksum How to use checksums |
c6ee76ca7d215cf3fbcfe54d5cf7391a2d477fb2469fc7003e8b0c7d425e378d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / fourier_mellin-0.2.0-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | fourier_mellin-0.2.0-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 32.3 MB |
| Tags | Linux glibc 2.17+ x86-64 PyPy 3.7 PyPy 3.7 7.3 |
|
SHA-256 checksum How to use checksums |
85ff99b63c8117dadda760d802190508c8526d7a69e0626e7076d69145549755
|
|
BLAKE2b-256 checksum How to use checksums |
d1976f8ac0aed8690cd6f8f2f05b1f1d97058d4e5e8e33e98434ea43801d0543
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / fourier_mellin-0.2.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | fourier_mellin-0.2.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 32.3 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
ce6ba940b42fab51af4fa996de22a029950063c888f48855196d2eb5eb75852f
|
|
BLAKE2b-256 checksum How to use checksums |
97afe9353248448a65143f3a9283dd6c9d1c21c498b2913b98e37f0bc108a63a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / fourier_mellin-0.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | fourier_mellin-0.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 32.3 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
518a283dbe8b8db606d27462892551b1b07922a5512b9a5e436dc8a78657471d
|
|
BLAKE2b-256 checksum How to use checksums |
57b8af31ab3fb9a54850c52260b988fabf3a13ec492c3b9e78a0a5946bef3953
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / fourier_mellin-0.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | fourier_mellin-0.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 32.3 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
f5e0bd2c0fe994cd608a7a58f09fecbcd4c1155948f235b321d5c305a8e7c671
|
|
BLAKE2b-256 checksum How to use checksums |
97aee3284b746336d9eb929ba27c671a6f6862d616e648111b83d5c765be8d28
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / fourier_mellin-0.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | fourier_mellin-0.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 32.3 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
66b0b589a694e3f5e7c102d68c21e00a751c42aa27aa7fdee498a9dde61b0b72
|
|
BLAKE2b-256 checksum How to use checksums |
19360307abd5ff7f56641047f8332b4797527e3d39bc699182283c06094d67bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / fourier_mellin-0.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | fourier_mellin-0.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 32.3 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
16bbeebb3674979147d0cdabeb3d065e45a0d68a3726c40752e9831afa85ecbe
|
|
BLAKE2b-256 checksum How to use checksums |
bbbb72a7aebc24e62facbdb50347391d0981d492374bbe40dedb3ec621f4af7b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / fourier_mellin-0.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | fourier_mellin-0.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 32.3 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
74b7bedde15c5010175181338a123e3e573ca6a312d92ed5ba24c784e2234613
|
|
BLAKE2b-256 checksum How to use checksums |
47de42394eb1cd4c496986d79b29c6530b6319ccad9e83b1f4bfe06e6c15ea78
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / fourier_mellin-0.2.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | fourier_mellin-0.2.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 32.3 MB |
| Tags | CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
afc58a06cb179f028db36e2398dde1a594bdd048244c1cf62a828b021c0b61ee
|
|
BLAKE2b-256 checksum How to use checksums |
2f17130d0959e9d091f123f0a52e5b21b4e4e036e9754329dfd8fa0a7d300604
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Security for fourier-mellin 0.2.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.