Skip to main content

Multifocal Image Stitching

Documentation Build Status
Build Status

This package aims to:

  • Accurately compute translation parameters between two images taken with a translation and focus change
  • Be tolerant of high levels of noise and blurriness caused by the focus change

This package does not:

  • Account for other non-translational camera models
  • Calculate subpixel-level stitching coordinates
  • Perform focus stacking or blending of images in any manner

Examples

Matching using low-frequency features:

Matching using high-frequency features:

Installation

To install from pypi:

pip install multifocal-stitching

Usage

Ensure the images to be stitched are sequentially named in <dir>, then run:

python -m multifocal_stitching <dir>

Most images can be stitched successfully with the default settings. To fine-tune settings with the CLI:

python -m multifocal_stitching -h
usage: __main__.py [-h] [-v] [--ext EXT] [--imgs IMGS [IMGS ...]] [--no_merge] [--workers WORKERS]
                   [--min_overlap MIN_OVERLAP] [--early_term_thresh EARLY_TERM_THRESH]
                   [--use_wins USE_WINS [USE_WINS ...]] [--peak_cutoff_std PEAK_CUTOFF_STD]
                   [--peaks_dist_threshold PEAKS_DIST_THRESHOLD]
                   [--filter_radii FILTER_RADII [FILTER_RADII ...]]
                   [--stitching_result STITCHING_RESULT] [--result_dir RESULT_DIR]
                   [--resize_factor RESIZE_FACTOR] [--save_gif]
                   dir

positional arguments:
  dir                   Base directory

options:
  -h, --help            show this help message and exit
  -v, --verbose         Increase output verbosity (default: False)
  --ext EXT             Filename extension of images (default: .jpg)
  --imgs IMGS [IMGS ...]
                        Stitch only provided images in provided order, otherwise will run in batch
                        mode over all images in directory (default: None)
  --no_merge            Disable generating merged images (default: False)
  --workers WORKERS     Number of CPU threads to use in FFT (default: 2)
  --min_overlap MIN_OVERLAP
                        Set lower limit for overlapping region as a fraction of total image area
                        (default: 0.125)
  --early_term_thresh EARLY_TERM_THRESH
                        Stop searching when correlation is above this value (default: 0.7)
  --use_wins USE_WINS [USE_WINS ...]
                        Whether to try using Hanning window (default: (0,))
  --peak_cutoff_std PEAK_CUTOFF_STD
                        Number of standard deviations below max value to use for peak finding
                        (default: 1)
  --peaks_dist_threshold PEAKS_DIST_THRESHOLD
                        Distance to consider as part of same cluster when finding peak centroid
                        (default: 25)
  --filter_radii FILTER_RADII [FILTER_RADII ...]
                        Low-pass filter radii to try, smaller matches coarser/out-of-focus features
                        (default: (100, 50, 20))
  --stitching_result STITCHING_RESULT
                        Stitching result csv file (default: stitching_result.csv)
  --result_dir RESULT_DIR
                        Directory to save merged files (default: merged)
  --resize_factor RESIZE_FACTOR
                        Whether to resize the images saved by a factor (default: 1)
  --save_gif            Whether to save a gif alternating between the merged files (default: False)

Metadata

Release files for multifocal-stitching 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for multifocal-stitching 0.2.1
File Size Uploaded
multifocal-stitching-0.2.1.tar.gz 11.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for multifocal-stitching 0.2.1
File Interpreter ABI Platform
multifocal_stitching-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 20.8 kB

Release files / multifocal-stitching-0.2.1.tar.gz

Download URL multifocal-stitching-0.2.1.tar.gz
Size 11.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2aa64b1562f816214603b5e9aea52973a93f37138fc5fb18a5ac4d798c789d25
BLAKE2b-256 checksum
How to use checksums
82472e6b138ba3925e19ba6bc88ccfefc4a8a27b1d2c36f7567700bcf6aa5d25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release files / multifocal_stitching-0.2.1-py3-none-any.whl

Download URL multifocal_stitching-0.2.1-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6397b3e201567a51ba6dca2923706c0d69bb4b2dbb14ebabc9b0a5aaf2e27a21
BLAKE2b-256 checksum
How to use checksums
f281c3d84891df0aa48be7ef2077db0f99dccc37ccb9b277f6705e9a6d673347
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2

2 release files

0.1.1

2 release files

0.1

2 release files

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