Skip to main content

OpenFocus Logo OpenFocus

OpenFocus delivers focus stacking quality that rivals commercial-grade software, while staying fully open source and easy to extend.

Python 3.10+ License: MIT GitHub Repository Download

📢 News

🎉 2026.09.29: v1.26 — fixed the "I/O operation on closed file" render crash in windowed builds and a stale embedded version number that kept offering updates users already had.

🎉 2026.09.28: v1.25 / v1.24 / v1.22 — portable mode (settings travel with the app), one-click in-app update with progress, EXIF preservation, HEIC/HEIF input, and render-failure tracebacks in the log folder.

🎉 2026.09.28: v1.21 — project files (.ofproj), built-in demo stack, per-frame sharpness curve, Japanese + Spanish interfaces.

Earlier milestones: v1.9–v1.20 brought the Wipe compare view, dark/light themes, Compare-All-Methods rendering, quick preview, cancellable background renders, 16-bit pipeline, registration disk cache, batch CLI, WebP export, Windows installer + macOS DMG, and CI test automation. Full history in the Changelog.

⬇️ Download & Install

No setup needed — grab a build from the Releases page:

Platform File Type
Windows 10/11 (64-bit) OpenFocus-*-setup.exe Installer (recommended)
Windows 10/11 (64-bit) OpenFocus-*-windows-x64.zip Portable (unzip and run)
macOS Apple Silicon (M1–M4) OpenFocus-*-macos.dmg Disk image (drag to Applications)
macOS Apple Silicon (M1–M4) OpenFocus-*-macos-arm64.zip Portable (unzip)

The app is unsigned, so the first launch may show a security prompt:

  • Windows: SmartScreen → "More info" → "Run anyway". The first start may take 30–60 s.
  • macOS: right-click → Open, or run xattr -cr /Applications/OpenFocus.app in Terminal.

Full details, including the portable mode and the log folder, are in the User Manual.

💻 Command Line Usage

Beyond the GUI, OpenFocus can run headless — handy for batch scripts and CI pipelines:

# Fuse a folder of images with guided filter, no registration
python main.py --input ./stack_folder --output ./result/fused.png

# DTCWT with ECC registration, 8 threads
python main.py -i ./stack_folder -o ./result/fused.png -m dtcwt -a ecc -t 8

# StackMFF-V4 forced to CPU with custom tile size
python main.py -i ./stack_folder -o ./result/fused.png -m stackmffv4 --cpu --tile-size 512

# Explicit file list instead of a folder; video files also work as input
python main.py -i img1.jpg img2.jpg img3.jpg -o fused.png -m gfgfgf

# Batch mode: fuse every folder into one output directory
python main.py --input ./stackA ./stackB --output-dir ./results

Exit codes: 0 success, 1 processing error, 2 usage error. Run python main.py --help for all options.

📖 Documentation

🛠️ Building from Source

For contributors and platforms without pre-built packages:

conda create -n openfocus python=3.10
conda activate openfocus
pip install -r requirements.txt
python main.py

Packaging with PyInstaller: see docs/BUILD_COMMANDS.md.

Table of Contents

🔭 Overview

OpenFocus is a PyQt6-based multi-focus registration and fusion workstation that delivers commercial-grade alignment and blending results. The project is fully open source (MIT License) and runs on CPU by default with optional GPU acceleration for the StackMFF V4 neural model.

OpenFocus UI

✨ Highlights

  • Beginner-Friendly: Plug-and-play workflows with unapologetically simple, guided operations.
  • Flexible Processing Flows: Run fusion-only, registration-only, or combined registration + fusion pipelines depending on your workload.
  • Wipe Compare View: Overlay any source frame and any result in one frame with a draggable divider and shared zoom — spot alignment errors at a glance.
  • Batch Automation: Kick off batch jobs across multiple folders with live progress, cancellation, and automatic output organization.
  • Headless CLI: Full pipeline from the command line with script-friendly exit codes.
  • Annotation & Export Toolkit: Overlay labels, export GIF animations, drag results straight out of the app, and save stacks in JPG/PNG/BMP/TIFF.
  • AI-Assisted Fusion: Ship with StackMFF V4 to unlock deep-learning-quality fusion alongside classic signal-processing methods.
  • Remembers You: Settings, language, GPU preference and recently opened stacks persist across sessions; bilingual UI throughout.

🧪 Algorithms

Fusion Algorithms

  • Guided Filter: Fast edge-preserving fusion that enhances contrast while suppressing noise.
  • DCT Multi-Focus Fusion: Frequency-domain technique optimized for crisp detail recovery.
  • Dual-Tree Complex Wavelet Transform (DTCWT): Multi-scale representation that preserves fine texture structures.
  • GFG-FGF: GFG-FGF is based on a generalized four-neighborhood Gaussian gradient (GFG) operator combined with a fast guided filter (FGF).
  • StackMFF V4: Pretrained deep model delivering state-of-the-art focus stacking quality.

Registration Algorithms

  • Homography: Performs feature-based projective alignment using keypoint matching and RANSAC to handle global perspective transformations.
  • ECC: Performs intensity-based alignment by maximizing the enhanced correlation coefficient for precise, sub-pixel registration.

License Notice: Every fusion/registration algorithm included comes from open-source research implementations. When using or redistributing them, please follow each algorithm’s original license terms in addition to the OpenFocus MIT license.

📚 References

  • M. B. A. Haghighat, A. Aghagolzadeh, and H. Seyedarabi, "Multi-focus image fusion for visual sensor networks in DCT domain," Computers & Electrical Engineering, vol. 37, no. 5, pp. 789-797, 2011.
  • J. J. Lewis, R. J. O'Callaghan, S. G. Nikolov, D. R. Bull, and N. Canagarajah, "Pixel- and region-based image fusion with complex wavelets," Information Fusion, vol. 8, no. 2, pp. 119-130, 2007.
  • S. Li, X. Kang, and J. Hu, "Image fusion with guided filtering," IEEE Transactions on Image Processing, vol. 22, no. 7, pp. 2864-2875, 2013.
  • 付宏语, 巩岩, 汪路涵, 等. 多聚焦显微图像融合算法[J]. Laser & Optoelectronics Progress, 2024, 61(6): 0618022-0618022-9.

🤝 Contribution

We welcome community contributions of all kinds:

  1. Issues: Report bugs, request features, or propose UX enhancements.
  2. Algorithm & Performance Work: Share new fusion/registration ideas, optimizations.

Bug reports or suggestions? Please open an issue so we can follow up quickly.

📄 License

This project is released under the MIT License. Feel free to use, modify, and distribute within the terms of the license.

If you publish images created with OpenFocus, please consider adding a note such as:

Created with OpenFocus – https://github.com/Xinzhe99/OpenFocus

This is not mandatory, but highly appreciated.

If OpenFocus helps you, please consider leaving a ⭐ on the repository!

⭐ Star History

Star History Chart

Metadata

Release files for openfocus 1.28

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

Source distribution (sdist)

Source distribution for openfocus 1.28
File Size Uploaded
openfocus-1.28.tar.gz 3.7 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for openfocus 1.28
File Interpreter ABI Platform
openfocus-1.28-py3-none-any.whl Python 3 none any Details

Total release size: 7.4 MB

Release files / openfocus-1.28.tar.gz

Download URL openfocus-1.28.tar.gz
Size 3.7 MB
Tags Source
SHA-256 checksum
How to use checksums
c33869b13276cd4ac6edf39b8351ecb619ae05a1265d830bda3506ae9f2047e4
BLAKE2b-256 checksum
How to use checksums
f80a19c3fb5e5fc1f97f904c1f10808a160d48dbcf239db29949a885117d3d5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.19

Release files / openfocus-1.28-py3-none-any.whl

Download URL openfocus-1.28-py3-none-any.whl
Size 3.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
b9a477aec53d79c144f77b7e2c7b08fdef3a42926c24f4b3dfb29ea9d97ea3c2
BLAKE2b-256 checksum
How to use checksums
2aac8758e37d032d596f50ddcf21c39cbca4b0cb471b17b88b0a36073df9a9ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.19

Release history Release notifications | RSS feed

1.32

1 release file

1.31

1 release file

1.30

1 release file

This release

1.28 This release

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