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
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)
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 tovals = np.eye(win_size) - (1.0/win_size)*(1.0 + np.einsum('...ij,...kj->...ik',X , winI - win_mu))
andL = computeLaplacian(img/255)
becomesL = computeLaplacian(img/255.0)