tfg.image.matting.linear_coefficients

Computes the matting linear coefficients.

Computes the matting linear coefficients (a, b) based on the pseudo_inverse generated by the build_matrices function which implements the approach proposed by Levin et al. in "A Closed Form Solution to Natural Image Matting".

matte A tensor of shape [B, H, W, 1].
pseudo_inverse A tensor of shape [B, H - pad, W - pad, C + 1, size^2] containing the pseudo-inverse matrices computed by the build_matrices function, where pad is equal to size - 1 and size is the patch size used to compute this tensor.
name A name for this op. Defaults to "matting_linear_coefficients".

A tuple contraining two Tensors for the linear coefficients (a, b) of shape [B, H, W, C] and [B, H, W, 1].

ValueError If the last dimension of matte is not 1. If matte is not of rank 4. If pseudo_inverse is not of rank 5. If B is different between matte and pseudo_inverse.