This repository contains a Matlab implementation of the osmosis filtering for shadow removal and seamless cloning
The anisotropic osmosis filtering is a drift-diffusion partial differential equation written as:
where d is the vector drift field. For isotropic diffusion, W is set to an identity matrix. A detailed explanation of the model can be found in [1] to [4].
In this project, we implemented a solver for the osmosis model based on the Alternating Direction Implicit (ADI) method and the Operator Splitting (OS) method. The applications include shadow removal and seamless cloning.
solve_imageFusion.m
Set local to true to apply Dirichlet boundary condition outside the ROI; otherwise, the osmosis will be solved globally.
The local and global osmosis filtering models are described in [5].
Input | Result (local) | Result (global):
solve_shadowRemoval.m
Set local to true to apply Dirichlet boundary condition outside the ROI; otherwise, the osmosis will be solved globally.
Set anisotrpic_diffusion to true to apply anisotropic diffusion on shadow boundary, which can preserve details inside the boundary.
For anisotropic diffusion, the Peachman-Rachford ADI scheme is not applicable since the problem contains mixed derivative term.
Input:
Result (isotropic+local) | Result (anisotropic+local):
Result (isotropic+global) | Result (anisotropic+global):
[1] Weickert, Joachim, et al. "Linear osmosis models for visual computing." International Workshop on Energy Minimization Methods in Computer Vision and Pattern Recognition. Springer, Berlin, Heidelberg, 2013.
[2] Vogel, Oliver, et al. "A fully discrete theory for linear osmosis filtering." International Conference on Scale Space and Variational Methods in Computer Vision. Springer, Berlin, Heidelberg, 2013.
[3] Calatroni, Luca, et al. "Alternating direction implicit (ADI) schemes for a PDE-based image osmosis model." Journal of Physics: Conference Series. Vol. 904. No. 1. 2017.
[4] Parisotto, Simone, et al. "Anisotropic osmosis filtering for shadow removal in images." Inverse Problems 35.5 (2019): 054001.
[5] d'Autume, Marie, Jean-Michel Morel, and Enric Meinhardt-Llopis. "A flexible solution to the osmosis equation for seamless cloning and shadow removal." 2018 25th IEEE International Conference on Image Processing (ICIP). IEEE, 2018.