No jobs
Core 10 min 5 of 5

The lens moved your labels

Distortion, crop, resize and compression act on the image and not on the depth map or the mask.

What this repairs

Assuming geometric artefacts are a nuisance on the image only, when distortion, crop and resize move pixels without moving the depth map, the mask or the auxiliary targets.

Assumes

The optics stage applies the effects that belong to the glass: radial distortion, chromatic aberration, blur, bloom, veiling glare, vignetting. Two structural facts about it are worth more than the list.

They are centred on the optical centre, not the image centre. Every one of these effects is computed from a radius built out of KKr=((ucx)/fx,  (vcy)/fy)r = \lVert((u - c_x)/f_x,\; (v - c_y)/f_y)\rVert — so when the principal point is off-centre, as it always is by a few pixels, the vignette and the distortion are off-centre with it. That is the physically correct choice, and it is also why a figure that draws the vignette around the image centre and one that draws it around (cx,cy)(c_x, c_y) disagree in a way that looks like a bug in both.

They are a look, not a derivation. The vignette is 1strengthmin((r/ρ)2,1)1 - \text{strength}\cdot\min\big((r/\rho)^2,\, 1\big) for a radius parameter ρ\rho — a mask with two dials on it. The physical falloff of an ideal lens is cos4\cos^4 of the field angle, which has no dials at all. These are different functions, and the simulation is honest about modelling the appearance rather than the optics — but it means the vignette strength is not a number you can carry to a real lens.

How far the labels move

  1. xd=(1+k1r2+k2r4)xn,r2=xn2+yn2x_d = (1 + k_1 r^2 + k_2 r^4)\,x_n, \qquad r^2 = x_n^2 + y_n^2

    Radial distortion in normalised coordinates, as always applied before K. The displacement is what is left when the ideal position is subtracted.

  2. Δxn=xdxnk1r2xn    Δxnk1r3\Delta x_n = x_d - x_n \approx k_1 r^2 x_n \;\Longrightarrow\; \lVert\Delta\mathbf{x}_n\rVert \approx k_1 r^{3}

    Because the displacement is radial, its magnitude is the radial factor times the radius itself — so it grows as the cube of the radius, not linearly. That cubic growth is the fingerprint.

  3. Δufxk1r2xn,Δvfyk1r2yn\Delta u \approx f_x\, k_1 r^2 x_n, \qquad \Delta v \approx f_y\, k_1 r^2 y_n

    In pixels, each component is scaled by its own focal length — which is also why the drift is not radially symmetric in pixel units unless the pixels are square.

  4. k1=0.015,  fx=500,  640×480    Δu4 px at the cornerk_1 = 0.015,\; f_x = 500,\; 640\times480 \;\Longrightarrow\; \lVert\Delta\mathbf{u}\rVert \approx 4\ \text{px at the corner}

    A coefficient of the size the camera preset samples, on a modest frame, already moves the corner by four pixels — while the centre moves by nothing at all. Nobody notices a four-pixel label error that is zero where they looked.

Check yourself

Your segmentation masks are within half a pixel of the image in the centre and about three pixels out at the corners. Which stage is responsible?

Show answer

Radial distortion applied to the RGB only. The signature is the growth law: a crop offsets everything by a constant, a resize scales the offset linearly with radius, and only the radial term grows as r3r^3 — negligible in the middle, several pixels at the edge. Confirm it by undistorting the image with the recorded k1,k2k_1, k_2 and re-checking the alignment; if the corners snap into place, you have found it, and the fix is to distort the masks with the same coefficients rather than to undistort every image at training time.

Euler View - ML Experiment Monitor