tfg.image.matting.linear_coefficients
Stay organized with collections
Save and categorize content based on your preferences.
Computes the matting linear coefficients.
tfg.image.matting.linear_coefficients(
matte: type_alias.TensorLike,
pseudo_inverse: type_alias.TensorLike,
name: str = 'matting_linear_coefficients'
) -> Tuple[tf.Tensor, tf.Tensor]
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".
Args |
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".
|
Returns |
A tuple contraining two Tensors for the linear coefficients (a, b) of shape
[B, H, W, C] and [B, H, W, 1] .
|
Raises |
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 .
|
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."],[],[],null,["# tfg.image.matting.linear_coefficients\n\n\u003cbr /\u003e\n\n|----------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/graphics/blob/master/tensorflow_graphics/image/matting.py#L168-L220) |\n\nComputes the matting linear coefficients. \n\n tfg.image.matting.linear_coefficients(\n matte: type_alias.TensorLike,\n pseudo_inverse: type_alias.TensorLike,\n name: str = 'matting_linear_coefficients'\n ) -\u003e Tuple[tf.Tensor, tf.Tensor]\n\nComputes the matting linear coefficients (a, b) based on the `pseudo_inverse`\ngenerated by the `build_matrices` function which implements the approach\nproposed by Levin et al. in \"A Closed Form Solution to Natural Image Matting\".\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `matte` | A tensor of shape `[B, H, W, 1]`. |\n| `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. |\n| `name` | A name for this op. Defaults to \"matting_linear_coefficients\". |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A tuple contraining two Tensors for the linear coefficients (a, b) of shape `[B, H, W, C]` and `[B, H, W, 1]`. ||\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ------ ||\n|--------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `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`. |\n\n\u003cbr /\u003e"]]