← सभी लेख

aiNov 22, 20267 मिनट में पढ़ें

Four Cameras, 360 Degrees: Can a Car Build a Live 3D Map?

In the last post we saw how one moving camera can build a 3D map live. Now imagine a car with four fisheye cameras: front, rear, left and right. Each one sees about 190 degrees, so together they see all around the car. Can these four cameras build a live 3D map? Yes, and in several ways they do it better than one camera. This post shows why, step by step, with simple maths and figures. You need only vectors, matrices and a little bit of differentiation.

In short, we will see five things:

  • how one equation links a 3D point to a pixel in any of the four cameras,
  • why four cameras give a steadier position than one,
  • how two overlapping cameras measure true depth in metres,
  • how turning the car also reveals the true size,
  • why the cameras must take their photos at the same moment.

Step 1: Three coordinate systems

Diagram: top view of a car with four fisheye cameras (front, rear, left, right), each seeing about 190 degrees with overlap at the corners; world, car and camera coordinate systems
Four fisheye cameras see all around the car. Only the car pose is unknown at each moment.

We describe every point in three ways. The world coordinates are fixed to the ground. The car coordinates move with the car: at time k the car is at position pk and turned by a rotation matrix Rk. Each camera c is screwed to the car at place bc and looks in direction Qc. These two are measured once, by calibration, and never change.

To see a world point X from the car, we first move the origin to the car and then undo the car’s rotation. Undoing a rotation is easy: we use the transpose RT (rows and columns swapped), because for a rotation matrix the transpose is the inverse:

mathbf{X}^{text{car}} = R_k^{top}left(mathbf{X} - mathbf{p}_kright)

We do the same again to go from the car to camera c:

mathbf{X}^{c} = Q_c^{top}left(mathbf{X}^{text{car}} - mathbf{b}_cright) = (x, y, z)

Finally the fisheye lens maps the point to a pixel. In an earlier post we saw the equidistant fisheye rule: the distance from the image centre grows with the angle θ from the optical axis.

theta = arctanfrac{sqrt{x^2+y^2}}{z}, qquad r = f,theta

u = c_u + rcosvarphi, qquad v = c_v + rsinvarphi

Here φ is the direction of the point around the centre. Putting the three steps together, the pixel where camera c sees point j at time k is

mathbf{x}_{cj} = pi!left( Q_c^{top}left( R_k^{top}left(mathbf{X}_j - mathbf{p}_kright) - mathbf{b}_c right) right)

Key point. Qc and bc are known. At each moment the only unknowns are the car’s Rk and pk: 3 numbers for the rotation and 3 for the position. That is 6 numbers, whether the car has 1 camera or 4. So four cameras give four times more measurements for the same 6 unknowns.

Step 2: Tracking with all four cameras together

Tracking means finding the car pose for the newest set of photos. We already know many 3D points Xj from the map. We choose Rk and pk so that the predicted pixels land as close as possible to the pixels we actually see, in all cameras at once:

E(R_k, mathbf{p}_k) = sum_{c=1}^{4} sum_{j} left| mathbf{x}^{text{seen}}_{cj} - pi!left( Q_c^{top}left( R_k^{top}(mathbf{X}_j - mathbf{p}_k) - mathbf{b}_c right) right) right|^2

Why do more cameras give a steadier answer? Start with the simplest case. Suppose we measure one number N times, and each measurement has a random error with spread σ. The average is

bar{y} = frac{1}{N}sum_{n=1}^{N} y_n

mathrm{Var}(bar{y}) = frac{1}{N^2}sum_{n=1}^{N}sigma^2 = frac{sigma^2}{N} quadRightarrowquad mathrm{sd}(bar{y}) = frac{sigma}{sqrt{N}}

More measurements, smaller error. The pose problem works the same way, only with 6 unknowns. If J is the matrix of how each pixel changes when the pose changes a little, the uncertainty of the pose is

mathrm{Cov}(text{pose}) approx sigma^2 left(J^{top}Jright)^{-1}, qquad J^{top}J = sum_{c=1}^{4} J_c^{top}J_c

Think of JTJ as “how much information we have”, and its inverse as “how unsure we are”. Each camera adds its own term to the information. More information, less doubt. Cameras that look in different directions also help in different directions: the side cameras pin down sideways motion very well, which the front camera alone sees poorly.

We checked this in a simulated street with 0.5 pixel noise. The front camera alone used 68 point observations; all four used 303. The sideways position error fell from 11.0 mm to 1.9 mm, and the heading error from 1.74 to 0.29 arc-minutes (one arc-minute is 1/60 of a degree), about six times better. The GIF also shows a second benefit: when low sun blinds the front camera, a one-camera system has nothing to track, but the other three cameras carry on.

Animation: a car drives down a simulated street; the position uncertainty ellipse is larger with the front camera only than with four cameras; in sun glare the one-camera system is lost while four cameras keep tracking
Code-generated illustration (simulated street and cameras), not real data.

Step 3: True depth where two cameras overlap

Diagram: two cameras a distance B apart see the same point; the shift d between the images gives depth Z = f B / d; a plot shows the depth error growing with the square of distance
Overlapping cameras act like a stereo pair. Depth error grows with distance squared.

Neighbouring fisheye cameras see the same area at the corners of the car. There they act like a stereo pair. Take two cameras a distance B apart (the baseline), both looking forward, and a point at depth Z and side position X. With the simple pinhole rule, the two image positions are

x_1 = f,frac{X}{Z}, qquad x_2 = f,frac{X - B}{Z}

Subtract them. The unknown X cancels, and what is left is called the disparity d:

d = x_1 - x_2 = frac{f,B}{Z} quadRightarrowquad Z = frac{f,B}{d}

Since B is measured in metres during calibration, Z also comes out in metres. This is how overlap gives the true size. How accurate is it? Differentiate Z with respect to d:

frac{dZ}{dd} = -frac{f,B}{d^2} = -frac{Z^2}{f,B} quadRightarrowquad left|Delta Zright| approx frac{Z^2}{f,B},left|Delta dright|

The error grows with the square of the distance. With B = 1 m, f = 320 pixels and a matching error of 0.5 pixel, a point 2 m away is off by about 0.6 cm, at 10 m by 15.6 cm, and at 20 m by 62.5 cm. So overlap gives excellent depth close to the car, and rougher depth far away.

Step 4: True size from turning

Diagram: driving straight, the rear camera moves exactly like the car; when turning by angle omega it moves an extra 2 b sin(omega/2), which is known in metres
Turning moves each camera by a different, known amount, which fixes the true scale.

What about points that only one camera sees? Look at how a camera moves. Camera c sits at the world position

mathbf{p}^{c}_k = mathbf{p}_k + R_k,mathbf{b}_c

Between two moments the camera moves by

Deltamathbf{p}^{c} = Deltamathbf{p} + left(R_{k+1} - R_kright)mathbf{b}_c

Driving straight: the rotation does not change, so Rk+1 = Rk and the second term is zero. Every camera moves by exactly the car’s motion. One camera can see the direction of its motion but not its length: if Δp = s t, any scale s explains the photos equally well.

Turning: now the second term is not zero. Take the car turning by an angle ω, so Rk = I and Rk+1 = R(ω). The vector bc swings around like the hand of a clock. Its tip moves along a chord of a circle with radius |bc|, and the chord of angle ω has length

left| left(R(omega) - Iright)mathbf{b}_c right| = 2,|mathbf{b}_c|,sinfrac{omega}{2}

This extra movement is different for each camera, and it is given in metres, because we measured bc in metres. So the photos can only be explained by one value of s: the true scale. For the rear camera, 2.2 m behind the car centre, a 5° turn moves it an extra 0.19 m and a 20° turn an extra 0.76 m. Small turns give a weak signal, so real systems also use wheel speed or a motion sensor (IMU).

Step 5: The cameras must agree on time

The four photos should be taken at the same moment. If one camera is late by Δt, the car has already moved

Delta x = v,Delta t

At 60 km/h (v ≈ 16.7 m/s), a delay of only 10 ms means 16.7 cm, far more than the millimetre accuracy of Step 2. That is why such cameras are usually triggered together by one hardware signal, or every photo carries an exact time stamp.

Step 6: Building the map and closing loops

Mapping works as in the last post, with key moments instead of key photos: when the car has moved enough, new points are triangulated from the photos of all cameras, and the last few car poses and points are adjusted together. Loop closure also becomes easier. When the car comes back down the same road from the opposite direction, the front camera sees the scene from a new side, but the rear camera sees it the same way as before, and can recognise it.

What is still hard

  • Moving things. Other cars and people are not part of the map. They must be detected and left out, usually with a deep-learning model.
  • Calibration must stay right. If a camera is knocked a little, its Qc and bc are wrong and the map bends. Good systems check and correct this while driving.
  • Night, rain and plain walls. Fewer visible points means weaker tracking, as the error formula above shows.
  • Computing. Four video streams need a GPU or smaller images to stay live.

So, can four cameras build a live 3D map? Yes. The car has only 6 unknowns at each moment, and four cameras give many more measurements for them. Overlapping corners give true depth, turning gives true scale, and the 360° view keeps tracking alive when one camera is blind. With good calibration and good timing, this is a solid way to give a car a live 3D picture of its surroundings.

टिप्पणी

टिप्पणियाँ

पहली टिप्पणी लिखें

आपका ईमेल कभी दिखाया नहीं जाएगा। जाँच के बाद टिप्पणी दिखेगी।