2. How DVS Rectification Works

This chapter explains how lens distortion affects event coordinates and how those coordinates are corrected. It first models lens distortion, then calculates the original sensor coordinate corresponding to one corrected output position. For DVS data, it chooses the nearest integer pixel and stores that correspondence in a LUT for real-time use.

In this chapter This chapter explains how lens distortion affects coordinates, how an original sensor location is calculated for each corrected output coordinate, and how the nearest DVS pixel is stored in a LUT.

2.1 A real lens and sensor introduce geometric offsets

An ideal pinhole camera projects a scene ray to one predictable point on the sensor. A real camera uses several curved lens elements in front of a physical sensor. Lens curvature, assembly tolerance, slight sensor tilt, and a shift between lens and sensor centres make the observed coordinate differ from that ideal point.

The scene object does not move. Its sensor coordinate does. Calibration measures that difference for the individual camera so that Rectify can later apply the measured relationship to arriving events.

Lens optical axis and sensor alignment diagram
A small lens or sensor offset changes where a scene point is recorded.

2.2 How distortion changes coordinates

Calibration does not choose a visual effect such as “barrel” or “pincushion.” It estimates coefficients that explain how this camera moves coordinates. The OpenCV model combines a radial term with tangential terms and, when present in the calibration, optional thin-prism terms.

2.2.1 Radial distortion

Radial distortion is centred on the optical centre and usually grows toward the image edge. It is why an otherwise regular grid may bow outward or inward. The rational radial scale L(r) expresses that centre-based change.

Checkerboard examples of barrel and pincushion distortion
Barrel and pincushion are opposite radial directions on the same regular grid.
r2 = x2 + y2
L(r) = 1 + k1r2 + k2r4 + k3r61 + k4r2 + k5r4 + k6r6
xr = xL(r), yr = yL(r)

2.2.2 Tangential distortion

When the lens is tilted slightly or not perfectly centred over the sensor, the displacement is not rotationally symmetric. The tangential coefficients p1 and p2 represent that decentring effect in the coordinate model.

Tangential distortion applied to a checkerboard
Tangential distortion bends the grid asymmetrically instead of evenly around one centre.
Δxt = 2p1xy + p2(r2 + 2x2)
Δyt = p1(r2 + 2y2) + 2p2xy

2.2.3 Optional thin-prism term

Depending on the distortion model, thin-prism coefficients s1 through s4 may be added. They represent residual asymmetric distortion caused by effects such as tilt between the lens and image plane, and Rectify applies them only when they are present in the calibration result.

Thin prism distortion applied to a checkerboard
Thin-prism terms describe an additional asymmetric residual.
Δxs = s1r2 + s2r4
Δys = s3r2 + s4r4

2.3 Calculate the source sensor coordinate from a corrected output

Rectification starts with one corrected output coordinate (u, v), not with an input event pushed forward. The following calculation asks where the original sensor must be sampled to fill that corrected location.

Input: rectified output coordinate (u, v) → Output: source-sensor coordinate (us, vs)

01
Normalize the output coordinate

x = (u − cx) / fx, y = (v − cy) / fy

02
Apply the lens distortion model

The radial, tangential, and, when present, thin-prism terms described above are combined for one coordinate.

xd = xL(r) + Δxt + Δxs, yd = yL(r) + Δyt + Δys

03
Return to the source sensor pixel

us = fxxd + cx, vs = fyyd + cy

One corrected output coordinate (u, v) produces one source sensor coordinate (us, vs).

For a stereo camera, each camera’s lens-distortion correction is accompanied by Stereo Rectification, which uses the relative position and orientation of the left and right cameras. It aligns corresponding observations from the same scene as closely as possible to the same y coordinate, or epipolar line, in the two images. Stereo Matching can then search for correspondences mainly along the horizontal direction.

2.4 Use the nearest integer DVS pixel for a calculated source coordinate

The calculated source coordinate may not be an integer. For example, a corrected output location may refer to (103.2, 198.7) on the original sensor. A conventional brightness image can interpolate nearby pixels to calculate a new intensity value.

A DVS event, however, is an ON, OFF, or absent state at one integer pixel. NRV Rectify does not mix neighbouring events. It selects the nearest integer coordinate—(103, 199) in this example—and keeps that location's event polarity.

Nearest integer source pixel selected from a fractional coordinate
Select the nearest integer pixel for a calculated fractional coordinate.

2.5 Store the prepared coordinate relationship as a LUT

The corresponding relationship between each corrected output coordinate and its original sensor coordinate is prepared as a lookup table (LUT) during Setup.

Setupcalibration.yaml → Coordinate calculation → Coordinate LUT
RuntimeLive DVS packet → LUT lookup → Rectified DVS packet

During live operation, Rectify looks up the prepared coordinate relationship instead of repeatedly evaluating the lens equations, then transforms each event location. Runtime output remains ordinary DVS packet data.

2.6 Valid ROI and final DVS output

After coordinate correction, some output locations can refer outside the physical input sensor. There is no original event to read at those locations, so the final output retains only the valid region that has real source coordinates.

NRV Rectify retains the Valid ROI and does not enlarge it back to the original frame size.

① Original DVS events

These are the original event coordinates with lens distortion still present.

Original DVS event observation
Original DVS events

② After coordinate correction

After the lens model corrects event coordinates, some edge locations can lie outside the original sensor area and cannot read a valid source event.

DVS event observation after coordinate correction
Rectify full coordinate output

③ Valid ROI applied

Only locations that can refer to original events remain. This region is not enlarged back to the original resolution.

Final DVS valid ROI output
Valid ROI output
Next: Chapter 3 shows how to prepare the YAML map and enable Rectify in Viewer.