Skip to main content

Image Registration Library

Project description

Image Registration src-code

The image-regist library is used to find the best parameters (rotation and translation of the x and y axes) to transform the target image to align with the reference image.

Concept

alt text

Using the Particle Swarm Optimization (PSO) algorithm for optimization and Mutual Information as a measurement metric for two images. The image-regist library tries to find the best parameters (rotation and translation of the x and y axes) of the target image so that they can be aligned with the reference image.

Installation

For installation, you can use pip

pip install image-regist

or clone from the repository

git clone https://github.com/mufis-coder/image_regist

Requirements

Install the packages below according to the version listed to use the image-regist library

  • numpy==1.21.6
  • Pillow==9.3.0
  • scipy==1.7.3

Usage

from PIL import Image
from image_regist.tools import Transform, findTransformation, transform_image_2d

# Load reference and target image
reference_image = Image.open("your-reference-image-file")
target_image = Image.open("your-target-image-file")

"""
Find best parameters to transform target image
----
In this example three transformations are used [Transform.ROTATION, Transform.TRANSLATION X, Transform.TRANSLATION_Y]. You can use less than three and you don't have to use them sequentially. The result of ---best_params--- is a list in the order according to the parameter ---params---.
---
If you want the algorithm to run faster, you can set parameter ---faster=True---
"""
best_params = findTransformation(data1=reference_image, data2=target_image, params=[Transform.ROTATION, 
                                Transform.TRANSLATION_X, 
                                Transform.TRANSLATION_Y], faster=False)

# Transform the target image according to the parameters that have been searched for
tranformed_image = transform_image_2d(target_image, [Transform.ROTATION, 
                                Transform.TRANSLATION_X, Transform.TRANSLATION_Y], 
                                best_params)

# Display transformed image
tranformed_image.show()

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

image_regist-0.0.3-py3-none-any.whl (2.1 kB view details)

Uploaded Python 3

File details

Details for the file image_regist-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: image_regist-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 2.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.6

File hashes

Hashes for image_regist-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 444086e9fbe2c6806b13283c01587630b470686e148a38523af0b15979220600
MD5 bb0ea7c604a6e0e9ae87e711137978fa
BLAKE2b-256 a9b5485be6f35f87c28a04117b695916fbf1ef26935012ddca37fb563eef6cbb

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