This is the implementation of the paper: Poisson Matting by Jian Sun, Jiaya Jia, Chi-Keung Tang and Heung-Yeung Shum done as part of Digital image processing course at IIIT Hyderabad.
git clone {url of the page}
or Click 'Clone or Download' on the top right hand side of the repository.
- install requirements using package manager pip(Use the package manager pip
pip3 install -r requirements.txt
cd project-made-online
- run any jupyter-notebook using
jupyter-notebook
- documents
- src
- main.ipynb
- examples
- Select_roi.py
- select_roi_curve.py
- img (contains input images)
- outs (contains output images)
- attachments (contains attachments)
- requirements.txt
The inputs of the code are
- An input image
- Trimap of the input image
- The desired background(to be changed in input image)
- Only thing to be replaced is image name in main with desired input images(in read input and roi select)
- Do kernel >run all and images would be generated in desired background along with refined mattes.
- Generated images from global matting and alpha blending in new background are saved in "outs" folder.
- After global matting results are obtained we apply local matting which is semi-supervised to get the final matte. Select roi will ask to select regions in image whose matte want to improve upon. Please select regions when pop-up select regions comes.
- The final matte is further refined by diffusion, highpass filtering and boosting.
- We also implemented mean background method where user can output the images with same foreground but different background to get the required matte which can be blended to any new background. Refer multi-background function for details on usage.