Skip to main content

Image Registration with Fourier Mellin using OpenCV

Project description

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

lena_transform_demo

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.

mkdir -p build/release
cd build/release
cmake ../.. -DCMAKE_BUILD_TYPE=Release
cd ../..
cmake --build build/release -j 4

Todo

  • PyPI
  • github actions workflows
  • Optimization
  • CUDA with OpenCV
  • cv::phaseCorrelate already applies Hanning Window
  • Documentation
  • Proper threading support

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fourier_mellin-0.1.3.tar.gz (4.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

fourier_mellin-0.1.3-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (32.3 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

fourier_mellin-0.1.3-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (32.9 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

fourier_mellin-0.1.3-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (32.9 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

fourier_mellin-0.1.3-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (32.9 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

fourier_mellin-0.1.3-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (32.9 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

fourier_mellin-0.1.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (32.9 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

fourier_mellin-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (32.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

fourier_mellin-0.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (32.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

fourier_mellin-0.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (32.9 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

fourier_mellin-0.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (32.9 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

fourier_mellin-0.1.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (32.9 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

fourier_mellin-0.1.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (32.9 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64

File details

Details for the file fourier_mellin-0.1.3.tar.gz.

File metadata

  • Download URL: fourier_mellin-0.1.3.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for fourier_mellin-0.1.3.tar.gz
Algorithm Hash digest
SHA256 b1d4e5bec7124f402846c92c13592f4a0585a42c76ba0f0d423bc8dfcd649031
MD5 fca4906ae03ab4546c5fa158560a6fa4
BLAKE2b-256 71be745d907d9e7a95f16ae2be3252a8340ac44b83bd983c4926d065435d45e5

See more details on using hashes here.

File details

Details for the file fourier_mellin-0.1.3-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fourier_mellin-0.1.3-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e41c96d15ca346b5c0e2257e5b7378c2b1cc99e318234479b9d104542d97a77a
MD5 caa53c3f92706cccca346988c2a56adb
BLAKE2b-256 27c13b75fdcbd064496479bb78940a78c6cf32f68d84bd6acd9f9843be6580d9

See more details on using hashes here.

File details

Details for the file fourier_mellin-0.1.3-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fourier_mellin-0.1.3-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f62fe5d2921bedc96d348aff1fe97d2965e2b61175ec13b6f842bf07c03c7d96
MD5 674e5f57f862b7568be7b8d408570614
BLAKE2b-256 6969c2a3a05665dc0851587de6253dd6b8f6fb3731ae0549ba8cc1c896264235

See more details on using hashes here.

File details

Details for the file fourier_mellin-0.1.3-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fourier_mellin-0.1.3-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 87136726611c52953f5d2e3805eec878fe6b5afcfb1b04d30ffb728e3e32dd62
MD5 c7f2fa42343652eb5f2d2b94d0daad35
BLAKE2b-256 9a3d3fe92e078a4b2aa654dd3024ae71b3b1610b0f82006bd8703b25035c4d2c

See more details on using hashes here.

File details

Details for the file fourier_mellin-0.1.3-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fourier_mellin-0.1.3-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c6e3cd0e50c0a3472910dec42f4d4c685006016b7d43bd6c2cce1dae3c19aba1
MD5 7e95536453abefcf92c7a2c66ab238ed
BLAKE2b-256 a02bc9fbc31a8ddc3f0ef90db29e8576c200597a3f8e1110ba9a65c8f9dcbea5

See more details on using hashes here.

File details

Details for the file fourier_mellin-0.1.3-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fourier_mellin-0.1.3-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 68aeb5acc43608d6e71125a961a1e26f74bc8b1e54fbcf110380d708f193b501
MD5 b16966329cf0edb3e0b1d92818d8476c
BLAKE2b-256 92db385fc99d2beab1feb8e37ecf7387adea095ec8e5f713370b8c5eb3ef4653

See more details on using hashes here.

File details

Details for the file fourier_mellin-0.1.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fourier_mellin-0.1.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b127577e8ecb61f3ee3b335460326d2083a41a698c2774d89e17e567f7c4056c
MD5 b6a1798225bc90734ce779495264d9bb
BLAKE2b-256 43685609db1397f3a267701ca565a59cb950dad6ea7286bb3b6833cb64964acb

See more details on using hashes here.

File details

Details for the file fourier_mellin-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fourier_mellin-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7e3b5010bdc9cd5c6c06c8acd621dcc5e09975cabc4e20f00ad65d96b411013e
MD5 f03026a770c3ada78a823cccd01e1414
BLAKE2b-256 47482695fbb1a3f1a4d2b46c70b0b4d995a8fc10be4039a5385561710762a145

See more details on using hashes here.

File details

Details for the file fourier_mellin-0.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fourier_mellin-0.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0ffb0dc5265dd95cba45605841d3f1454c920dac65365b17336789a7995002d7
MD5 563c59d7103201a3702df18f3c945b79
BLAKE2b-256 8df06eed0f575e4e1b9b00c43e49cdf81bf53e5be8c41d69f1731e3b21e1bde2

See more details on using hashes here.

File details

Details for the file fourier_mellin-0.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fourier_mellin-0.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0ad5f9a3a4e7c94049ca8595a9dc88cee58a40a31c55d6275515edd054781fa9
MD5 cb6e25ba681c41798ce52d4cfe640ee8
BLAKE2b-256 d4d0c653cce27d867f153821aa1c5875f32da74a275caf73f61157ff1c10ad74

See more details on using hashes here.

File details

Details for the file fourier_mellin-0.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fourier_mellin-0.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b94ef88b7d26b948a4e40575d99cbae33d8f47970527d6b606bf72411c93c4c7
MD5 84e2291e4694573d1693d2f4e7253d42
BLAKE2b-256 86fb7e4c2e275b018a515a8743411e7e7ccdfb63b0141aae8cc94b30f43dd130

See more details on using hashes here.

File details

Details for the file fourier_mellin-0.1.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fourier_mellin-0.1.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 378a3786fecfeacf52b6d20957dda7839bdd2d9a3e5b1eb7b3b0ce6f7114162b
MD5 abede4fc52f1d595904ad0ccd7e953c1
BLAKE2b-256 61ac876a141eba51d822870426df548cbedc0c812a3619c91e87b14d0005bada

See more details on using hashes here.

File details

Details for the file fourier_mellin-0.1.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fourier_mellin-0.1.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e0cf51a2d37b0f50bd05520eace57c870fb37bb3834a296cae580fe465dd52e5
MD5 fce061de409a986175e0a7d419bc931b
BLAKE2b-256 1f033632f8649a3360d49a93affafc025018e70ebeb956a5f96a86b111fea6c2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page