Module: tfg.rendering.camera.quadratic_radial_distortion
Stay organized with collections
Save and categorize content based on your preferences.
Quadratic radial lens distortion and un-distortion functions.
Given a vector in homogeneous coordinates, (x/z, y/z, 1)
, we define
r^2 = (x/z)^2 + (y/z)^2
. We use the simplest form of distortion function,
f(r) = 1 + k * r^2
. The distorted vector is given by
(f(r) * x/z, f(r) * y/z, 1)
.
To apply the undistortion, we need the inverse of f(r), g = f^{-1}. In this
library we use the approximate formula for the undistortion function given here
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4934233/, and refine the solution
using Newton-Raphson iterations (https://en.wikipedia.org/wiki/Newtons_method).
Restricting the distortion function to quadratic form allows to easily detect
the cases where r
goes beyond the monotonically-increasing range of f
(which
we refer to as overflow).
Functions
distortion_factor(...)
: Calculates a quadratic distortion factor given squared radii.
undistortion_factor(...)
: Calculates the inverse quadratic distortion function given squared radii.
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 2021-08-09 UTC.
[null,null,["Last updated 2021-08-09 UTC."],[],[],null,["# Module: tfg.rendering.camera.quadratic_radial_distortion\n\n\u003cbr /\u003e\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/graphics/blob/master/tensorflow_graphics/rendering/camera/quadratic_radial_distortion.py) |\n\nQuadratic radial lens distortion and un-distortion functions.\n\nGiven a vector in homogeneous coordinates, `(x/z, y/z, 1)`, we define\n`r^2 = (x/z)^2 + (y/z)^2`. We use the simplest form of distortion function,\n`f(r) = 1 + k * r^2`. The distorted vector is given by\n`(f(r) * x/z, f(r) * y/z, 1)`.\n\nTo apply the undistortion, we need the inverse of f(r), g = f\\^{-1}. In this\nlibrary we use the approximate formula for the undistortion function given here\n\u003chttps://www.ncbi.nlm.nih.gov/pmc/articles/PMC4934233/,\u003e and refine the solution\nusing Newton-Raphson iterations (\u003chttps://en.wikipedia.org/wiki/Newtons_method\u003e).\n\nRestricting the distortion function to quadratic form allows to easily detect\nthe cases where `r` goes beyond the monotonically-increasing range of `f` (which\nwe refer to as overflow).\n\nFunctions\n---------\n\n[`distortion_factor(...)`](../../../tfg/rendering/camera/quadratic_radial_distortion/distortion_factor): Calculates a quadratic distortion factor given squared radii.\n\n[`undistortion_factor(...)`](../../../tfg/rendering/camera/quadratic_radial_distortion/undistortion_factor): Calculates the inverse quadratic distortion function given squared radii."]]