We present a novel shadow removal where the inputs are a single natural image to be restored and its corresponding shadow mask. We first decompose the image by super-pixels and cluster them into several similar regions. Then we train a random forest model to predict matched pairs between shadow and non-shadow regions. By applying a distribution-based mapping function on the matched pairs, we can relight pixels in those shadow regions. An optimization framework based on half-quadratic splitting (HQS) method is also introduced to further improve the quality of the mapping process. We also design a post-processing stage with a boundary inpainting function to generate better visual results. Our experiments show that the proposed method can remove shadows effectively and produce high quality shadow-free images
This repository contains the Matlab demo code for the shadow removal algorithm described in the following ICME 2022 paper:
Shadow Removal Through Learning-based Region Matching And Mapping Function Optimization
Shih-Wei Hsieh, Chih-Hsiang Yang, Yi-Chang Lu
This code is tested in Windows Matlab 2020b version. Other Matlab version may work but the result may be different.
- Matlab 2020b or higher.
- Image Processing toolbox
If the priovided mex executable cannot be used in your environment, please follow instructions in readme to compile the mex for the following library:
- SLIC-superpixel in
./SLIC-superpixel-master/
- Daisy descriptor in
./DAISY/
- Run the demo code:
demo.m
The demo code runs with a small subset of the ISTD dataset.
Input image | Result (shadow removed) || Input image | Result (shadow removed)
The shadow mask is produced using the code provided here.
The full set of shadow masks and shadow removal results for the ISTD dataset can be download from respective paths.
If you find this code useful in your research, please give a reference to the paper.
@inproceedings{hsieh2022shadow,
title={Shadow Removal Through Learning-Based Region Matching and Mapping Function Optimization},
author={Hsieh, Shih-Wei and Yang, Chih-Hsiang and Lu, Yi-Chang},
booktitle={2022 IEEE International Conference on Multimedia and Expo (ICME)},
pages={1--6},
year={2022},
organization={IEEE Computer Society}
}