tfg.image.matting.build_matrices
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.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2022-10-28 UTC.
[null,null,["Last updated 2022-10-28 UTC."],[],[]]