Post-captured Dynamic Focus & Aperture Control
This repo contains code to run Refocus - an image editing technique to change focus point and f-stop setting in a post-processing manner.
To reproduce our work, please do the following steps:
- Clone the repo
git clone https://github.com/KhanhNgoDuy/Refocus.git
- Prepare your python environment
- Install necessary packages
pip install -r requirements.txt
- Run
If the path is not specified, the code defaults to test on our prepared example.
python main.py --img_path <path/to/your/test_img>
Our solution implements two distinct approaches to address the refocusing task, a physics-based model and a deep learning-based model.
The physics-based approach leverages the canonical principle in photography: Circle of Confusion.
Our deep learning-based approach leverages Diffusion Models to learn complex real lens optical effects, which are difficult to model explicitly through physical equations.
Training
Below is our training pipeline, training data is available at NTIRE 2023 Bokeh Effect Transformation.
Testing
Our test data is available here.