← Все статьи

aiNov 19, 20263 мин чтения

The Night the Cameras Taught Me Geometry

Yesterday I wrote about Structure from Motion, the idea that a handful of ordinary photos can be turned into a 3D world. On a tidy set of holiday pictures it feels like magic. This week I tried it somewhere far less tidy, and it became one of the most interesting problems I have worked on in a long time.

The setting was a heavy working vehicle with four fisheye cameras mounted around it, one looking forward, one backward and one to each side, all recording at night. There was no GPS and no position log, only video and a few sensor signals. The question sounded simple: from these cameras alone, can we tell where each camera sits on the machine, how it is tilted, and where the vehicle travels?

My first run looked promising for about an hour. Then the map started to fold in on itself. So I went detective-hunting, and the first culprit was hiding in plain sight. The cameras could see their own vehicle.

Animation: a night fisheye camera view; green circles on walls and lamps flow outward while red crosses on the vehicle's own hood and yellow arm stay still
Code-generated illustration, not real data.

Watch the picture above for a moment. As the vehicle drives, the walls and lamps flow outward across the fisheye image. Those green points are the useful ones, because their motion tells SfM where the camera went. The red crosses sit on the vehicle itself, on the hood and on the yellow arm, and they never move in the image at all. To SfM, a patch of pixels that never moves means a camera that never moves, and the two stories fight each other. Masking the body helped, but the moving arm needed its own mask in every single image. The night made things worse, because a few lamps and long plain walls leave very little for a feature matcher to hold on to.

Even after those fixes, the long trajectory refused to behave. It folded back on itself, jumped tens of metres in a single frame, and stretched like rubber. I could have kept tuning it forever. Instead, I started asking SfM smaller, sharper questions.

The first question was about the lens. A fisheye bends every ray in its own way, and if that model is wrong, nothing built on top of it can be right. SfM can estimate the distortion by itself, so I compared its estimate with the calibration file.

Graph: the fisheye lens curve from the calibration file and the curve SfM estimated by itself lie on top of each other
Code-generated illustration, not real data.

The two curves lie almost on top of each other, within about one percent across the whole image. That single check meant I could fix the lens model, stop tuning it, and look for the remaining problems somewhere else.

The second question was about the cameras themselves. Where exactly is each one on the vehicle, and how far is it tilted towards the ground? Here came the most satisfying surprise of the week.

Left: a reconstructed vehicle path that folds and jumps away from the true loop. Right: a vehicle with four cameras, front, left, rear and right, whose tilt angles were recovered correctly
Code-generated illustration, not real data.

On the left is the path SfM gave me: broken, jumping, nothing like the real loop. On the right is what the very same reconstruction said about the camera rig, and that part was right. The tilt angles it recovered for the cameras matched the measured rig within about 1.5 degrees. A map that would not close still knew exactly where its cameras were and which way they were looking.

That turned out to matter more than a pretty map. In simulation, our cameras had been placed with guessed angles, so the simulated world looked subtly wrong: too much floor here, a horizon in the wrong place there. With the recovered positions and tilts, the simulated cameras could finally see the world the way the real ones do.

Two simulated fisheye views, one with a guessed camera tilt and one with the recovered tilt, and an illustrative training-error graph where the recovered geometry reaches a lower error
Code-generated illustration, not real data.

And the model noticed. Trained on images from the corrected cameras, it learned faster and settled at a clearly lower error than before. Better geometry in, better learning out.

Looking back, the lesson is not that SfM works or that SfM fails. A failing reconstruction is full of information if you ask it the right questions. Sometimes the most valuable output of an algorithm is not the result you asked for, but the confidence to trust the pieces underneath it.

All figures are code-generated illustrations, not real project data.

Комментировать

Комментарии · 2

Оставить комментарий

Ваш адрес почты не будет показан. Комментарии появляются после проверки.