Git Product home page Git Product logo

focus-stack's Introduction

Fast and easy focus stacking

This project implements a cross-platform tool for focus stacking images. The application takes a set of images captured at different focus distances and combines them so that the complete subject is in focus.

Installation

Binary packages for Windows 10, Ubuntu 18.04 and Mac OS X are available on the GitHub releases tab. Ubuntu packages are also available from this PPA.

There are nightly builds here: https://jpa.kapsi.fi/jenkins/job/focus-stack/

Basic usage

In most cases just passing all the images is enough:

 build/focus-stack .../path/to/input/*.jpg

For advanced usage, see --help for list of all options:

Usage: build/focus-stack [options] file1.jpg file2.jpg ...

Output file options:
  --output=output.jpg           Set output filename
  --depthmap=depthmap.png       Write a depth map image (default disabled)
  --3dview=3dview.png           Write a 3D preview image (default disabled)
  --save-steps                  Save intermediate images from processing steps
  --jpgquality=95               Quality for saving in JPG format (0-100, default 95)
  --nocrop                      Save full image, including borders with partial data

Image alignment options:
  --reference=0                 Set index of image used as alignment reference (default middle one)
  --global-align                Align directly against reference (default with neighbour image)
  --full-resolution-align       Use full resolution images in alignment (default max 2048 px)
  --no-whitebalance             Don't attempt to correct white balance differences
  --no-contrast                 Don't attempt to correct contrast and exposure differences
  --align-only                  Only align the input image stack and exit

Image merge options:
  --consistency=2               Neighbour pixel consistency filter level 0..2 (default 2)
  --denoise=1.0                 Merged image denoise level (default 1.0)

Depth map generation options:
  --depthmap-threshold=16       Threshold to accept depth points (0-255, default 16)
  --depthmap-smooth-xy=16       Smoothing of depthmap in X and Y directions (default 16)
  --depthmap-smooth-z=32        Smoothing of depthmap in Z direction (default 32)
  --halo-radius=20              Radius of halo effects to remove from depthmap
  --3dviewpoint=x:y:z:zscale    Viewpoint for 3D view (default 0.5:1.0:0.5:2.0)

Performance options:
  --threads=2                   Select number of threads to use (default number of CPUs + 1)
  --batchsize=8                 Images per merge batch (default 8)
  --no-opencl                   Disable OpenCL GPU acceleration (default enabled)

Information options:
  --verbose                     Verbose output from steps
  --version                     Show application version number
  --opencv-version              Show OpenCV library version and build info

On Windows you can additionally just select the photos and drag them over focus-stack.exe to run with default settings.

On Mac OS X, you can start the program directly and it will ask for files. Alternatively you can drag the files over focus-stack application. If you want to provide command line parameters, open terminal and call the binary with path focus-stack.app/Contents/MacOS/focus-stack.

Algorithms used

The focus stacking algorithm used was invented and first described in Complex Wavelets for Extended Depth-of-Field: A New Method for the Fusion of Multichannel Microscopy Images by B. Forster, D. Van De Ville, J. Berent, D. Sage and M. Unser.

The application also uses multiple algorithms from OpenCV library. Most importantly, findTransformECC is used to align the source images.

Building on Ubuntu

The only dependency is OpenCV, 3.0 or newer, plus the basic build tools:

sudo apt install libopencv-dev build-essential

To enable GPU acceleration, you additionally need OpenCL library and GPU-specific driver:

sudo apt install ocl-icd-opencl-dev beignet            # For Intel GPUs
sudo apt install ocl-icd-opencl-dev nvidia-opencl-icd  # For NVidia GPUs

To build and install the application, simply type:

make
make install

Or to build a Debian/Ubuntu package and install it, type:

sudo apt install debhelper devscripts
make builddeb
sudo dpkg -i DEBUILD/focus-stack*.deb

Building on Windows

Download OpenCV binary package for Windows from OpenCV website. Download Build Tools for Visual Studio 2019 from Microsoft.

In Visual Studio command prompt, execute:

nmake -f Makefile.windows

Building on Mac OS X

Install Homebrew by running this in terminal:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Then install build dependencies:

brew install opencv pkg-config dylibbundler

Finally, build and install to /usr/local/bin:

make
make install

Alternatively you can build an application bundle that can be used on any machine and that also includes a simple GUI for selecting the files:

make build/focus-stack.app

focus-stack's People

Contributors

petteriaimonen avatar fraf0 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.