https://www.tangramvision.com/blog/the-deceptively-asymmetric-unit-sphere [6011cb9b29] Request A Technical Demo or Trial Let's explore if we can help accelerate your perception development and deployment. Name[ ]Email*[ ]Company [ ] [Submit] Thank you! We'll be in touch soon. Oops! Something went wrong while submitting the form. Tangram Logo Products Sensor Calibration Production Line CalibrationContinuous Calibration Hardware HiFi AI-Enabled 3D Sensor resources Depth Sensor VisualizerLiDAR VisualizerOpen Source ProjectsSensor Datasheet LibraryCalibration Desk Reference CompanyDOCSBlogLog in See How It Works [5fffb6d173][5fffb6d1f2][5fffb6d1c7][5fffb6d180] < Back to Blog The Deceptively Asymmetric Unit Sphere By Devon Morris , | November 21, 2024 # Calibration Table of Contents Previously, we talked about [Pinhole Obsession](https:// www.tangramvision.com/blog/camera-modeling-pinhole-obsession) and the downsides of assuming a default pinhole model. We presented an alternative formulation where rays are modeled on the unit sphere \\ (\mathcal{S}^2\\) instead of the normalized image plane \\(\mathbb{T} ^2\\). We've also previously written posts about how many problems in robotics can be formulated as [an optimization](https:// www.tangramvision.com/blog/introduction-to-optimization-theory). At a high level, many continuous optimization algorithms perform the following steps - Compute a quantity to minimize -- error, misalignment, risk, loss, etc. - Compute a direction along which the quantity is locally reduced - Move the parameters in the quantity-reducing direction - Repeat until the problem converges Many continuous optimization problems are modeled on [vector spaces] (https://en.wikipedia.org/wiki/Vector_space) and "moving" the parameters is simply vector addition. However, our prescription of using the unit sphere to model rays is obviously **not** a linear space! Therefore, we must start our discussion by describing how to travel on the sphere. ## Traveling on the Sphere Generally, when we *travel* we want to do so in the most efficient manner. Undoubtedly, you've heard the expression "get from point a to b," perhaps also with the implication "as fast as possible." Therefore, we'll want to minimize the distance that we travel or equivalently travel along the shortest path. In Differential Geometry, we call these "shortest paths" *geodesics.* An alternate way to view a *geodesic* is by starting at a point \\(p\ \) on the manifold and traveling in the direction of some vector \\(v \\), carefully minimizing the distance at each increment. However, minimizing the distance at each step may mean we have to *change direction* along our shortest path. "Changing direction" and "traveling in the shortest path" may seem to counter one another. After all, we all know that the shortest path between two points is a line. However, imagine we are flying in a plane starting at the equator and a heading of 45deg. If our goal is to travel *as far as possible* from our starting point, how should we chart our course? > As usual, ignore air resistance, the jet stream and assume a spherical earth. This is a thought exercise, not pilot's school. A simple suggestion would be to maintain a heading of 45deg during our travel, like we would locally: travel in a constant direction. However, if we maintain a fixed heading indefinitely, we will end up close to the north pole! The line traced by a path of constant heading is known as a [Rhumb Line](https://en.wikipedia.org/wiki/ Rhumb_line) and, as pictured, is certainly not the shortest distance between two points on a sphere. ![Loxodrome.png](https://cdn.prod.website-files.com/ 5fff85e7f613e35edb5806ed/673f6319ebc7cd01b693200a_Loxodrome.png) *PC: [https://en.wikipedia.org/wiki/Rhumb_line#/media/ File:Loxodrome.png](https://en.wikipedia.org/wiki/Rhumb_line#/media/ File:Loxodrome.png)* Alternatively, to truly travel the *farthest distance,* we travel along the [great circle](https://en.wikipedia.org/wiki/ Great-circle_distance) until the aircraft runs out of fuel. Here it's more obvious that the geodesic's heading is continuously changing. One implication of this is that if we start at one point along the geodesic with a vector \\(v\\), we may not end up in the same location as if we start at a different point along the geodesic with the same vector \\(v\\). ![Illustration_of_great-circle_distance.svg](https:// cdn.prod.website-files.com/5fff85e7f613e35edb5806ed/ 673f8b9f2d9bfdd0a7e52425_Illustration_of_great-circle_distance.png) *PC: [https://en.wikipedia.org/wiki/Great-circle_distance#/media/ File:Illustration_of_great-circle_distance.svg](https:// en.wikipedia.org/wiki/Great-circle_distance#/media/ File:Illustration_of_great-circle_distance.svg)* In Differential Geometry, the operator that traces the geodesic is known as "the exponential map." For the reasons listed above, it's defined as a local operator originating at a point \\(p\\) and traveling in a direction \\(v\\) i.e. $$ \text{Exp}_p(v) $$ Similarly, the operator that computes the direction and distance between two points on the manifold (the manifold's logarithm) is defined as a local operator \\(\text{Log}_p(q)\\). So to perform optimization on the unit sphere, we - Compute the quantity to minimize -- error, misalignment, risk, loss, etc. - Compute a direction \\(v\\) along which the quantity can be locally reduced - Move the parameters along the great circle using the exponential map \\(\text{Exp}_p(v)\\) - Repeat until the problem converges This begs the question: how do we compute this direction \\(v\\)? What does it really mean? --- ## The Briefest Introduction to Differential Geometry > [?][?] Many maths below! But they're cool maths, we promise. To explain what a direction \\(v\\) means on the sphere and to explain why working with \\(\mathcal{S}^2\\) is difficult, we have to briefly touch on one of my favorite subjects: [Differential Geometry] (https://en.wikipedia.org/wiki/Differential_geometry). This post will dive deep into the motivations behind why we use differential geometry in computer vision, and what advantages it brings. Much of this may seem like a tangent (no pun intended), but don't worry: we'll bring it all back to our Pinhole Obsession and optimization at the end! > Obviously, we cannot cover the entirety of Differential Geometry in one blog post. There are many great resources to learn Differential Geometry. Some of our favorites are: > - [Introduction to Smooth Manifolds](https://link.springer.com/book /10.1007/978-1-4419-9982-5) > - [A Micro Lie Theory for State Estimation in Robotics](https:// arxiv.org/pdf/1812.01537) > - [Differential Geometry and Lie Groups](https://link.springer.com/ book/10.1007/978-3-030-46040-2) Historically, differential geometry arose from the study of "curves and surfaces." As traditionally taught in multi-variable calculus, a curve is a mapping \\(\gamma: \mathbb{R} \to \mathbb{R}^3\\) and likewise, a surface is a mapping \\(\sigma: \mathbb{R}^2 \to \mathbb {R}^3\\). Differential geometry generalizes these "curves and surfaces" to arbitrary dimensions. These generalized "curves and surfaces" are known as *smooth manifolds*. In this post, we'll skip the rigorous definition of a smooth manifold and simply define it as > *Smooth Manifold:* An N-dimensional space without corners, edges or self-intersections. This smoothness (called continuity) allows us to perform optimization "on the manifold" using our standard calculus techniques. We can compute errors and also compute the directions along which we can reduce those errors. ## Intrinsic vs Extrinsic Manifolds To assist intuition, we've leaned on prior knowledge of multi-variable calculus of curves and surfaces. At the undergraduate level, curves and surfaces are presented as [embedded entities] (https://en.wikipedia.org/wiki/Nash_embedding_theorems) living in a higher-dimensional ambient space e.g. 3D Euclidean Space. However, this ambient space isn't *strictly* needed for the development of differential geometry. In their search for a minimal set of axioms, differential geometers have taken great care to remove this dependence on an ambient space; they describe *smooth manifolds* as objects existing in their own right. Thus, there are two ways of thinking about differential geometry: - *Extrinsic*: manifolds as embedded objects in space - *Intrinsic*: manifolds are entities in their own right In this manner, the error-minimizing direction we are searching for can either be viewed as *extrinsic* (embedded in ambient space) or it can be viewed as *intrinsic* (living alongside the manifold). As engineers, the decision to use the intrinsic view of a manifold vs. the extrinsic view mostly impacts representation and computation. Thus, for a specific manifold, we choose the representation that's computationally easiest to work with. Although the remainder of this post only briefly touches on the representation of manifolds, it's **always** necessary to determine what representation is being used. The decision of an intrinsic or extrinsic representation will change how computation is performed on the manifold. Regardless of the choice of *intrinsic* or *extrinsic* representation, we often "bundle" the representation of the manifold with the representation directions on that manifold. > [?][?] The concepts of *intrinsic* and *extrinsic* used in differential geometry are unrelated to intrinsics (interior orientation) and extrinsics (exterior orientation) of cameras. This is simply an unfortunate naming collision at the intersection of two fields. ## A Brief Tangent for Tangents ...which brings us to **the** key concept in differential geometry: the [Tangent Bundle](https://en.wikipedia.org/wiki/Tangent_bundle). The Tangent Bundle is the underlying manifold stitched together with the vector spaces that are tangent to the manifold at each point. To illustrate this, consider the unit circle \\(\mathcal{S}^1\\) below. The blue circle represents the underlying manifold and the red lines represent the one dimensional tangent space at each point on the circle. Together, the points and tangent spaces form the tangent bundle. It is important to note that that vectors in one tangent space should be regarded as distinct and separate from vectors in another tangent space. ![Tangent_bundle.svg](https://cdn.prod.website-files.com/ 5fff85e7f613e35edb5806ed/673f63501b983d8e9953910b_image.png) *PC: [https://commons.wikimedia.org/wiki/File:Tangent_bundle.svg] (https://commons.wikimedia.org/wiki/File:Tangent_bundle.svg)* Now that we have the correct picture in our heads, let's visualize tangent vectors and the tangent bundle in more detail. Consider an arbitrary manifold \\(M\\), and furthermore consider a curve on that manifold \\(\gamma: \mathbb{R} \to M\\). This curve \\ (\gamma(t)\\) can be thought of "the location on the manifold at time \\(t\\)." Furthermore, let \\(\gamma(0)\\) be some point of interest \\(p \in M\\) on the manifold. For visualization, consider this wavy circle manifold: ![GenericManifold_ManimCE_v0.18.1.png](https:// cdn.prod.website-files.com/5fff85e7f613e35edb5806ed/ 673f636093b3a75b96cec282_GenericManifold_ManimCE_v0.18.1.png) Now, consider the curve \\(\gamma(t)\\) living on this manifold.