Skip to main content

template-align

Align images based on a template

Installation

Create and select your environment using your favorite environmant management tool, e.g.

python -m venv template-environment
source template-environment/bin/activate

and install via

pip install template-align

for a editable installation, clone this project and pipinstall it in development mode

clone git@github.com:mathiaszinnen/template-align.git
cd template-align
pip install -e .

Usage

Command Line

To align a folder of images according to a template image run the alignment tool as follows:

template-align PATH/TO/TEMPLATE.jpg PATH/TO/IMAGEDIR 

Note that the path arguments have to be adapted.

By default the aligned images will be saved to ./output/aligned relative to the current working directory. The output dir can be changed using the --output-dir flag.

template-align PATH/TO/TEMPLATE.jpg PATH/TO/IMAGEDIR --output_dir PATH/TO/OUTPUTDIR

Visualizations of the mappings can be enabled via the --visualize flag. They will be saved to a matches subdirectory below the specified output directory.

template-align PATH/TO/TEMPLATE.jpg PATH/TO/IMAGEDIR --visualize 

Python

To align images within python, simply import template-align and invoke the align function:

import os
import cv2
from glob import glob
from template-align import align

image_dir_path = os.path.join('path','to','images')
template_path = os.path.join('path','to','template.jpg')
image_paths = glob.glob(os.path.join(image_dir_path,'*.jpg'))
image_names = [fn for fn in os.listdir(image_dir_path) if os.path.splitext(fn)[-1] == '.jpg']
images = [cv2.imread(p) for p in image_paths]
template = cv2.imread(template_path)

aligned_images = align(images, template, visualization_path=None, image_names=image_names)

Acknowledgements

Thank you to Jeta Sopa whose work on template alignment this project is based on.

Metadata

Release files for template-align 0.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 template-align 0.0.2
File Size Uploaded Provenance
template_align-0.0.2.tar.gz 41.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for template-align 0.0.2
File Interpreter ABI Platform
template_align-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 70.1 kB

Release files / template_align-0.0.2.tar.gz

Download URL template_align-0.0.2.tar.gz
Size 41.0 kB
Tags Source
SHA-256 checksum
How to use checksums
405107dda7598d457e2a5dc58bdf90436fc369f4919d64c4ca2be4ce0e60862d
BLAKE2b-256 checksum
How to use checksums
15abdf1d6620792233abdb052cb6c866b7f7e820fd837234d7af648316f15519
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.11

Release files / template_align-0.0.2-py3-none-any.whl

Download URL template_align-0.0.2-py3-none-any.whl
Size 29.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
015aab4d9b9ccf118c75018d66d7b61034fbe7a6c9432fb4f4e88c3f3bbd3aff
BLAKE2b-256 checksum
How to use checksums
c068177692fb3f835a18e2b08407542718e1e4035de4093c1c788ed030475509
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.11

Security for template-align 0.0.2

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.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

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