Conic equation of Fisheye line projection

146 Views Asked by At

When using an equidistant fisheye projection of 3d world points to a 2d image plane, straight 3d lines appear as conic sections on the image.

Given a 3d line defined by a point $P=(Px,Py,Pz)$ and a direction vector $D=(Dx, Dy, Dz)$, I am trying to determine the conic coefficients $(a,b,c,d,e,f)$ where $ax^2 + bxy + cy^2 + dx + ey + f = 0$ of the curve on which lie the points projected from this line.

I am able to compute this conic from 5 projected points, but I would like to find a way to express this directly in terms of $P$ and $D$.

The projection of a 3d point $(X,Y,Z)$ to the 2d point $(x,y)$ is defined by the following equations:

  • $d = \sqrt{X^2 + Y^2 + Z^2}$
  • $\sin(\theta) = \frac{\sqrt{X^2 + Y^2}}d$
  • $r = f \cdot \theta$ (with $f = \frac 2 \pi$ for a 180° field of view)
  • $\cos(\phi) = \frac X {\sqrt{X^2 + Y^2}} $
  • $\sin(\phi) = \frac Y {\sqrt{X^2 + Y^2}} $
  • $x = \cos(\phi)\cdot r$
  • $y = \sin(\phi)\cdot r$

From a 2d point, we can compute a normalized 3d point (lying on a unit sphere centered at the origin) the following way:

  • $r = \sqrt{ x^2 + y^2}$
  • $\phi = atan2(y, x)$
  • $\theta = \frac r f$
  • $X = \sin(\theta) \cdot \cos(\phi)$
  • $Y = \sin(\theta) \cdot \sin(\phi)$
  • $Z = \cos(\theta)$
1

There are 1 best solutions below

1
On BEST ANSWER

From your transformation equation, one can find the transformed $(x,y)$ of any point of the line $$ (x_0+\alpha t,\ y_0+\beta t,\ z_0+\gamma t) $$ (note that I redefined $P=(x_0,y_0,z_0)$ and $D=(\alpha,\beta,\gamma)$) to be: $$ x=\frac{2 (\alpha t+x_0) \sin ^{-1}\left(\frac{\sqrt{(\alpha t+x_0)^2+(\beta t+y_0)^2}}{\sqrt{(\alpha t+x_0)^2+(\beta t+y_0)^2+(\gamma t+z_0)^2}}\right)}{\pi \sqrt{(\alpha t+x_0)^2+(\beta t+y_0)^2}}, \\ \ \\ \ \\ y=\frac{2 (\beta t+y_0) \sin ^{-1}\left(\frac{\sqrt{(\alpha t+x_0)^2+(\beta t+y_0)^2}}{\sqrt{(\alpha t+x_0)^2+(\beta t+y_0)^2+(\gamma t+z_0)^2}}\right)}{\pi \sqrt{(\alpha t+x_0)^2+(\beta t+y_0)^2}}. $$ But this cannot be the parametric equation of a conic. To prove that, I considered the particular case $(x_0,y_0,z_0)=(1,1,0)$ and $(\alpha,\beta,\gamma)=(2,1,1)$ and found two different sets of five points on the above curve, the first one corresponding to $t=0,1,\dots,4$ and the second to $t=5,6,\dots,9$. For each of those sets I used Mathematica to find exact values for coefficients $b,c,d,e,f$ in the general equation of a conic (I fixed $a=1$) and found that the two solutions were different. The difference between the two computed values of $d$, for instance, was about $0.176115$.