Skip to main content

Exposure fusion of multiple images

Project description

Exposure Fusion

Python implementation of exposure fusion of multiple images, using the algorithm described in:

Mertens, Tom, Jan Kautz, and Frank Van Reeth. "Exposure Fusion." Computer Graphics and Applications, 2007. PG'07. 15th Pacific Conference on. IEEE, 2007.

Combines a bracket of differently-exposed images into a single well-exposed result via multi-resolution pyramid blending, without HDR radiance map estimation or tone mapping.

Features

  • Exposure fusion — Laplacian pyramid blending with contrast, saturation, and well-exposedness weighting
  • Automatic alignment — Translation-only alignment via ECC (Enhanced Correlation Coefficient), pure NumPy
  • Time-decay weighting — Progressive weighting for sequential image stacks (e.g. time-lapses)
  • No OpenCV required — All image operations reimplemented in NumPy; runtime deps are numpy + Pillow only

Requirements

  • Python >= 3.10
  • numpy
  • Pillow

OpenCV is optional and only needed for running the test suite.

Installation

pip install exposure_fusion

Or from a local checkout:

pip install .

With test dependencies:

pip install "exposure_fusion[test]"

CLI Usage

exposure-fusion [-h] [-o OUTPUT] [-d DEPTH] [--time-decay TIME_DECAY]
                [--align] [-v] IMAGE [IMAGE ...]

Arguments:

Argument Description
IMAGE (positional, 2+) Input image file paths
-o, --output Output image path (default: fusion.jpg)
-d, --depth Pyramid depth (default: 3)
--time-decay Time decay factor for sequential images
--align Enable translation alignment before fusion
-v, --verbose Print progress messages to stderr

Examples:

exposure-fusion samples/peyrou_mean.jpg samples/peyrou_under.jpg samples/peyrou_over.jpg -o result.jpg
exposure-fusion --align -d 4 samples/peyrou_mean.jpg samples/peyrou_under.jpg samples/peyrou_over.jpg -o result.jpg
exposure-fusion --time-decay 4 samples/time_decay_1.png samples/time_decay_2.png samples/time_decay_3.png samples/time_decay_4.png -o fusion.png

Also invocable as python -m exposure_fusion.

Python API

Pass file paths directly to exposure_fusion and align_images — no manual I/O needed:

from exposure_fusion import exposure_fusion, align_images, load_image, save_image

# Load bracket exposures
img1 = load_image('samples/peyrou_mean.jpg')
img2 = load_image('samples/peyrou_under.jpg')
img3 = load_image('samples/peyrou_over.jpg')

# Optional alignment
images = align_images([img1, img2, img3])

# Fuse
fusion = exposure_fusion(images, depth=4)

save_image('samples/peyrou_fusion.jpg', fusion)

# Or pass paths directly — no load_image needed:
fusion = exposure_fusion([
    'samples/peyrou_mean.jpg',
    'samples/peyrou_under.jpg',
    'samples/peyrou_over.jpg',
], depth=4)
save_image('samples/peyrou_fusion.jpg', fusion)

# Time-decay fusion (e.g. time-lapse)
images = [load_image(f'samples/time_decay_{i}.png') for i in range(1, 5)]
fusion = exposure_fusion(images, depth=3, time_decay=4)
save_image('samples/time_decay_fusion.png', fusion)

Tests

pip install "exposure_fusion[test]"
pytest tests/

License

MIT

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

exposure_fusion-0.3.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

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

exposure_fusion-0.3-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file exposure_fusion-0.3.tar.gz.

File metadata

  • Download URL: exposure_fusion-0.3.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for exposure_fusion-0.3.tar.gz
Algorithm Hash digest
SHA256 340bf1c8392e918fc74950e17171be925a9085d1edf8ae406949f9b2c743b22d
MD5 e36519b09d8503f276c1016b4a56ba9a
BLAKE2b-256 d997197e4bd1f830c0686f175250328ee22fada6b9f5616f93459933b987be5d

See more details on using hashes here.

File details

Details for the file exposure_fusion-0.3-py3-none-any.whl.

File metadata

  • Download URL: exposure_fusion-0.3-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for exposure_fusion-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0a94a2e81c18d561259c5b8c036159d54d41f80d66588d1947c505f242c7f2dc
MD5 6ceadc5be7132d821d343fc70c82b7b1
BLAKE2b-256 d9c3942a7bfd8b652cc1fbdc3dee312026175b65874aaae8cc48e041dcbac859

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