Skip to content

Application of All-in-Focus image processing created by Python (OpenCV Python, NumPy and Tkinter).

Notifications You must be signed in to change notification settings

wieczorek-daniel/all-in-focus-imaging

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python All-in-Focus Imaging

Introduction

Application of All-in-Focus image processing created by Python (OpenCV Python, NumPy and Tkinter).

Pipeline

  1. Choose directory with .png images for All-in-Focus image processing
  2. Load image and the next image
  3. Check if images are RGB or grayscale
  4. Calculate gradient in x and y directions for each image
  5. Calculate gradient for each pixel of both images
  6. Calculate difference between image gradients for each pixel
  7. Create filter matrix 3x3 filled with ones
  8. Convolution filter with filter matrix and array from 6)
  9. Decide pixel from which image is better and save result

If there is more than two files, image in the next iteration will be result of fused images from previous iteration. At the end save output .png file with fused images.

Setup

First install the dependencies (required packages) using following command:

pip3 install -r requirements.txt

Then run main .py script using command:

python all_in_focus.py

Example result

Input data:

1st image 2nd image 3rd image 4th image
1st image 2nd image 3rd image 4th image

Output data:

References

No. Reference Source
1. Implementation of algorithm based on "A Computationally Efficient Algorithm for Multi-Focus Image Reconstruction" scientific work from Electrical Engineering Department of Stanford University
Authors: Helmy A. Eltoukhy and Sam Kavusi
URL
2. Grayscale images data
Author: Samet Aymaz
URL
3. RGB images data
Authors from the Graphics and Imaging Laboratory of the University of Washington
URL

About

Application of All-in-Focus image processing created by Python (OpenCV Python, NumPy and Tkinter).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages