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.4-py3-none-any.whl (2.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: image_regist-0.0.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e7a0000d3df55a164bc85d77ba97c22f1900fe15c0f35e22a9b3cfb9378a828a
MD5 26305bcabcb7134a5d750f597f3915d6
BLAKE2b-256 4cb599310d67aec536ec2af5d5a052304638ec97c7e9cadbd0af067b7f5c33cb

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