Generates the closed form matting Laplacian.
tfg.image.matting.build_matrices(
image: type_alias.TensorLike,
size: int = 3,
eps: type_alias.Float = 1e-05,
name: str = 'matting_build_matrices'
) -> Tuple[tf.Tensor, tf.Tensor]
Generates the closed form matting Laplacian as proposed by Levin et
al. in "A Closed Form Solution to Natural Image Matting". This function also
return the pseudo-inverse matrix allowing to retrieve the matting linear
coefficient.
Args |
image
|
A tensor of shape [B, H, W, C] .
|
size
|
An int representing the size of the patches used to enforce
smoothness.
|
eps
|
A small number of type float to regularize the problem.
|
name
|
A name for this op. Defaults to "matting_build_matrices".
|
Returns |
A tensor of shape [B, H - pad, W - pad, size^2, size^2] containing
the matting Laplacian matrices. A tensor of shape
[B, H - pad, W - pad, C + 1, size^2] containing the pseudo-inverse
matrices which can be used to retrieve the matting linear coefficients.
The padding pad is equal to size - 1 .
|
Raises |
ValueError
|
If image is not of rank 4.
|