Yunyung/Bayesian-Matting-implementation

實作 "A Bayesian Approach to Digial Matting" Paper中的Bayesian Matting進行圖片的前後景分割,將前景合成到另一張圖上。 專案使用到cv2.Diliation、Gaussian Mixture Model、Bayesian Approach等方法來達成前景、後景分割。

★ 3Forks 1PythonGitHub ↗Compare

README

Bayesian Matting

This project implements the Bayesian Matting technique described in Yung-Yu Chuang, Brian Curless, David H. Salesin, and Richard Szeliski. A Bayesian Approach to Digital Matting. In Proceedings of IEEE Computer Vision and Pattern Recognition (CVPR 2001), Vol. II, 264-271, December 2001[1]

The implementation details is a lttle bit differenct from Paper

  1. Instead of using the continuously sliding window for neighborhood, the project apply cv2.dilation to find the neighborhood
  2. Using Gaussian Mixture Model to cluster the data points not the method of Orchard and Bouman[2]
  3. Without using Gaussian falloff to weights the contribution of nearby pixels

Runing the demo

'python Bayesian Matting.py'

More Information

For more information see the orginal project website http://grail.cs.washington.edu/projects/digital-matting/image-matting/

The implementation was mostly adapted from Michael Rubinsteins matlab code here, http://www1.idc.ac.il/toky/CompPhoto-09/Projects/Stud_projects/Miki/index.html

More traing,testing images and different image matting Alogorithm here, http://www.alphamatting.com/index.html

Results

origin

trimap

Done by Bayesain Matting(alpha)

composite with another landScape

References

[1] Yung-Yu Chuang, Brian Curless, David H. Salesin, and Richard Szeliski. A Bayesian Approach to Digital Matting. In Proceedings of IEEE Computer Vision and Pattern Recognition (CVPR 2001), Vol. II, 264-271, December 2001

[2] M. T. Orchard and C. A. Bouman. Color Quantization of Images. IEEE Transactions on Signal Processing, 39(12):2677– 2690, December 1991.

Contributors

Yunyung

Issues