https://www.gravatar.com/avatar/27a538401cfbdd05b0fb7caff89d188c?s=512&d=mp
I do camera/lidar thingies.

Musings on Equality

1

One of the core insights Marx offers in Capital—that the engine of value creation shifts from labor to capital—still says a lot about our society. Many dismiss Capital as nonsense because communism collapsed, yet the concentration of the means of production undeniably dilutes each individual’s economic worth and demolishes the rungs of the class ladder.

2

Debates on equality have drifted with the times. They began with ‘all are equal before the law.’ Later, the focus moved to equality of opportunity—think of the special admissions quotas for rural students meant to offset unequal access to quality schooling. Ironically, the very moment everyone is granted the same opportunities can be the most unequal, because if the playing-field is declared level, unequal outcomes are blamed on the individual. (Not all of us can be Usain Bolt.) More recently, via the language of ‘equity’, the discussion has shifted again—from legal equality, through opportunity, toward equality of outcomes. Progressives call this justice; conservatives call reverse discrimination. (That split is natural, since left and right diverge most sharply over how resources should be distributed.)

5-point algorithm

Introduction

The Essential matrix, despite its inherent weaknesses (e.g., rotation-only motion, small baseline, planar degeneracy), is a kind of “magical” method for reconstructing 3D structure and camera pose using nothing more than simple point correspondences, for known cameras. In particular, in a SLAM scenario, a calibrated camera is usually given, which makes the Essential matrix even more useful compared to the Fundamental matrix.

An especially important fact is that the minimal solution for the Essential matrix can be obtained with 5 pairs of corresponding points. Out of the 6 degrees of freedom, the scale term is not included, so effectively we have 5 degrees of freedom. We call this the 5-point algorithm. At some point, I came across an internet reply claiming that the 8-point algorithm is slower but somehow yields more accurate results. That’s simply not true. Based on my experience, it’s not true at all. Here’s why. First, once you’re running RANSAC, the difference between using 8 points and 5 points can be quite significant. Second, since the 5-point algorithm mathematically defines the model perfectly, the 8-point algorithm inherently carries approximation errors. This is because it uses redundant constraints. Throwing more numbers at the problem isn’t necessarily better than using the right numbers. Is having redundant constraints truly more accurate? Not really. In fact, many libraries now treat the 5-point solution as the de facto standard. Third. It might be a somewhat trivial point, but if you’re using a large number of feature points anyway, both methods ultimately boil down to finding the nullspace via SVD. You can still use 8 points in the 5-point framework; it’s just not necessary, so we don’t do it. Finally, putting aside all the reasons above, the 5-point algorithm is simply better. Plenty of papers include performance comparisons to back this up, including the 5-point algorithm paper by Hongdong Li et al.

Solving polynomials using Gröbner basis

Algebraic geometry is a field of mathematics that studies properties of geometric objects (algebraic varieties) defined by polynomial equations, using algebraic methods. In general, when modeling certain phenomena, you inevitably end up with differential equations or polynomial equations. In most engineering contexts, we often use differential equations for modeling, but once you use polynomials, the problem falls under algebraic geometry. A typical example is the inverse kinematics problem, and another one—my own entry point into algebraic geometry—is the geometry involved in computer vision. In addition, cryptography also deals quite a bit with polynomials, and CAD systems that involve freeform surfaces eventually rely on algebraic solutions as well.

Fast inverse square root and modern methods

I’ve come across the fast inverse square root algorithm before, but at the time I just thought, “Wow, that’s cool,” and moved on. Suddenly, I got curious about it again and tried to understand it. Since the Wikipedia article felt a bit lacking, I derived it on my own, and while I was at it, I looked into more modern approaches as well. This post is a summary of that.

SO3(1) - Basic concepts

Toy Example

Let’s consider a 2D toy example. Suppose we are going to describe a robot moving in two dimensions. The description here can consist of three degrees of freedom: $pos_x,$ $pos_y,$ and $\theta$. Then, if we express the position of an object as seen from the robot’s coordinate system as $x_{local} ,$ $y_{local} ,$ it represents the position from the robot’s perspective. (I expressed them as $x$, $y$, etc., to avoid using too many subscripts.) If we view the position seen by the robot from the global coordinate system representing the robot’s pose,

Introduction

Background

We live in a three-dimensional world. Therefore, describing space inherently occurs within three dimensions. Every field that deals with spatial concepts necessarily builds upon this three-dimensional description, which is generally referred to as a rigid transformation. Describing an object’s pose in three dimensions is equivalent to describing its spatial transformation, and this is essential in various fields such as robotics, computer vision, and graphics.

However, it is unfortunate that there are very few writings that provide a deep understanding of rotations. While there are numerous articles that focus on specific topics like Euler angles, Rodrigues' formula, and quaternions, comprehensive works that offer an integrated understanding are rare. I have not found any writings that cohesively cover the connections between bivectors and quaternions, the transition from axis-angle to screw theory, or the links from Lie Groups, Lie Algebras to manifolds within a single, unified framework. As a result, most people (including myself) who begin studying rotation groups have no choice but to gradually acquire knowledge about $\mathrm{SO3}$ (referring to Rotation Matrices) step by step, much like a blind person feeling an elephant with their hands.

How fast is Atomic compared to mutex?

Test Goal

  • How fast is Atomic compared to mutex?

  • When using a mutex, is the overhead of lock_guard significant?

  • When using atomic, is there any meaningful benefits with memory_order_relaxed?

Settings

void workerWithLock(int work_count, int work_size) {
  thread_local mt19937 gen(random_device{}());
  thread_local normal_distribution<float> nd(0, 10);

  for (int i = 0; i < work_count; i++) {
    int work = 0;
    for (int j = 0; j < work_size; j++)
      work += static_cast<int>(nd(gen));

    mtx.lock();
    critical_data += work;
    mtx.unlock();
  }
}

In this manner, I placed the RNG in thread_local, and used two parameters, which is work_count and work_size. The conditions were the following four.

  • mutex self lock & unlock