/depth-aware-motion-deblurring

Mirror from https://square-src.de/gitlab/franzi/study-thesis. This is my study thesis - a reference implementation of the depth-aware motion deblurring algorithm by Xu and Jia.

Primary LanguageC++

Study Thesis

My study thesis (Belegarbeit) in computer vision based on the paper "Depth-Aware Motion Deblurring" of Xu and Jia.

They use spatially-varying point spread functions to deblur the image depending on the depth layer. The results can be found here: website.

conclusion: It wasn't possible to reconstruct the results from the paper. :( The estimated PSFs are too blurry. The second pass isn't possible because the disparity map ins't refined but downgraded.

Structure of the code

motion-deblurring contains the depth-aware motion deblurring algorithm together with the a disparity estimation, region tree and edge map implementation. The top-level PSF estimation isn't working (see used two-phase kernel estimation) so there is a work-around. And the mid-level PSF estimation produces very blurry kernel.

two-phase-kernel This code isn't finished! Until now it contains the first phase of the two phase kernel estimation. This algorithm would be used for the top-level PSF estimation.

utils contains useful matlab conversion like conv2, the deconvolution with FFT and the spatial deconvolution from Levin and an implementation of the coherence shock filter from Weickert.

tools provides small programs to use same parts of the motion-deblurring algorithm like convolution, deconvolution and other to show their correctness.

external contains the source code for the match disparity algorithm from Kolmogorov which is slightly changed to fit my needs to work with OpenCV (the image data can be copied directly from OpenCV to the match algorithm).

Building

You can build all components from the toplevel following the next steps.

Requirements

CMake configuration

CMake is the used build tool. Use an additional build folder to have clean source folders.

# create a build directory (all CMake Files will be saved there)
mkdir build
cd build

# Create a build configuration
# CMAKE_BUILD_TYPE= Release for disabling output (doesn't show/save images ...)
cmake -D CMAKE_BUILD_TYPE=Release ..

# use make for building all make targets or specify the needed target
make

Make targets

motion-deblurring

This is the main algorithm. Some tasks can be done in parallel so the number of threads can be specified.

make motion-deblurring

# Executable can be found in build/bin
# the default values can be used together with the mouse images
bin/motion-deblurring ../images/mouse-left.jpg ../images/mouse-right.jpg [--psf-width <n>] [--layers <n>] [--threads <n>] [--max-top-nodes <n>] [--max-disparity <n>] [--fft/--irls] [--help]

Work-around for missing top-level psf estimation: top-level kernels will be loaded instead of computed. So use the sample top-level kernels - place them in the folder where you starts the algorithm.

Literature on Motion Deblurring

Books

  • A. N. Rajagopalan, Rama Chellappa - Motion Deblurring: Algorithms and Systems (ISBN 9781107044364)

Paper (sorted by relevance)

Main Referemces of "Depth-Aware Motion Deblurring"

Additional Papers