MarcoForte / closed-form-matting

Python implementation of A. Levin D. Lischinski and Y. Weiss. A Closed Form Solution to Natural Image Matting. IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), June 2006, New York
MIT License
435 stars 107 forks source link

Changes necessary to make it work in Python 2.7 #1

Closed Quasimondo closed 7 years ago

Quasimondo commented 7 years ago

Just FYI: in order to make the example run correctly in Python 2.7 there are two changes necessary to deal with the different handling of integer division:

vals = np.eye(win_size) - (1/win_size)*(1 + np.einsum('...ij,...kj->...ik',X , winI - win_mu)) needs to be changed to vals = np.eye(win_size) - (1.0/win_size)*(1.0 + np.einsum('...ij,...kj->...ik',X , winI - win_mu)) and

L = computeLaplacian(img/255) becomes L = computeLaplacian(img/255.0)

MarcoForte commented 7 years ago

Thanks I'll change this now