tfg.rendering.camera.quadratic_radial_distortion.distortion_factor
Calculates a quadratic distortion factor given squared radii.
tfg.rendering.camera.quadratic_radial_distortion.distortion_factor(
squared_radius: type_alias.TensorLike,
distortion_coefficient: type_alias.TensorLike,
name: str = 'quadratic_radial_distortion_distortion_factor'
) -> Tuple[tf.Tensor, tf.Tensor]
Given a vector describing a location in camera space in homogeneous
coordinates, (x/z, y/z, 1)
, squared_radius is r^2 = (x/z)^2 + (y/z)^2
.
distortion_factor multiplies x/z
and y/z
to obtain the distorted
coordinates. In this function, distortion_factor
is given by
1.0 + distortion_coefficient * squared_radius
.
Note |
In the following, A1 to An are optional batch dimensions, which must be
broadcast compatible.
|
Args |
squared_radius
|
A tensor of shape [A1, ..., An, H, W] , containing the
radii of the image pixels computed as (x/z)^2 + (y/z)^2 . We use squared
radius rather than the radius itself to avoid an unnecessary sqrt , which
may introduce gradient singularities. The non-negativity of squared radius
is only enforced in debug mode.
|
distortion_coefficient
|
A scalar or a tensor of shape [A1, ..., An] ,
which contains the distortion coefficients of each image.
|
name
|
A name for this op. Defaults to
"quadratic_radial_distortion_distortion_factor".
|
Returns |
distortion_factor
|
A tensor of shape [A1, ..., An, H, W] , the correction
factor that should multiply the projective coordinates (x/z) and (y/z)
to apply the distortion.
|
overflow_mask
|
A boolean tensor of shape [A1, ..., An, H, W] , True where
squared_radius is beyond the range where the distortion function is
monotonically increasing. Wherever overflow_mask is True,
distortion_factor 's value is meaningless.
|
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."],[],[]]