A stereo rig that behaves in air starts lying the moment it sits behind a flat port: depth maps bow, measured gaps shrink and the reprojection error climbs no matter how many frames you add. The cause is physical, not numerical. The port and the water bend every ray at the housing wall, and that bend depends on distances a pinhole model never sees. This guide gives the numbers to plan around, a worked example with the arithmetic shown, and the decision: which calibration approach stays metric underwater, and which is only good enough for guidance.
What a flat port does to the rays
Light leaves the target in water (n ≈ 1.333), crosses the acrylic or glass port (n ≈ 1.49) and arrives in the camera's air space (n ≈ 1.000). Snell's law applies at each boundary. For parallel port faces the glass cancels out of the angle mapping, and three relations cover most flat-port rigs:
Here a is the entrance-pupil-to-port distance, t the port thickness and z the object distance beyond the outer face, all paraxial. Axially, water compresses distance by its index: 900 mm of water acts like 900 / 1.333 ≈ 675 mm, so the scene reads about 25% closer than taped. Angularly, the field narrows: an 80° in-air FOV has a 40° half-angle; sin 40° = 0.643; 0.643 / 1.333 = 0.482; arcsin gives 28.9° per side, so the underwater FOV is about 58°. Lateral size barely changes while depth shrinks, so targets also appear about 30% larger. Seawater, n ≈ 1.339, shifts apparent distance by about 3 mm per 900 mm of water.
Size the port window from the in-air angle first: the focal length calculator below returns FOV_air from sensor width and focal length; the arcsin factor converts it for underwater.
Why the pinhole-plus-radial fit fails underwater
A pinhole-plus-radial-distortion fit, the model most calibration tools fit by default, warps the image by pixel position only. The same pixel offset gets the same correction whether the object sat at 300 mm or 3,000 mm. Refraction does not behave that way: its strength depends on a, t, the indices and the object depth through the a + z / n term, plus an angle-dependent Snell bend. One fixed coefficient set can cancel that combination at a single depth only.
Run the fit on submerged frames anyway and it absorbs the ~25% compression at the calibration distance, then drifts everywhere else; residuals grow with field angle and with range. Plan on two to three times your in-air RMS: the refractive residual adds to the lens's own radial terms and the two trade off inside the fit. For average and maximum targets to reach in air first, see the calibration residual targets guide.
Transferring in-air parameters is worse: the worked example below quantifies the scale miss, and the depth-dependent bend is absent from the model entirely. More frames cannot rescue a wrong model; they only average the same bias.
A worked example: tape measure versus camera
Take a generic compact stereo rig; the values are illustrative, not a catalog product. The entrance pupil sits 60 mm behind the inner port face, the port is 10 mm acrylic, and a flat target is taped 900 mm beyond the outer face. Sum the apparent contributions: d_apparent = 60 + 10 / 1.49 + 900 / 1.333 = 60 + 6.7 + 675.5 ≈ 742 mm, against 970 mm taped from the pupil. The camera sees the target about 24% closer, and the magnification 970 / 742 ≈ 1.31 makes it look about 30% larger, the classic flat-port effect.
Now the stereo depth-resolution floor, so the refraction error has a scale to beat. With baseline B = 120 mm, focal length f = 2.5 mm, pixel pitch 3 µm and matching error 0.2 px, the disparity error is σ_d = 0.2 × 3 µm = 0.6 µm = 0.0006 mm, and σ_z ≈ z² σ_d / (f B). At z = 1,000 mm: 1,000,000 mm² × 0.0006 mm / 300 mm² = 2 mm of geometric resolution. The uncorrected refraction error in the example above is about 228 mm at that range, two orders of magnitude larger. Range degrades stereo edges even with a perfect model, which the stereo depth edge accuracy guide explains for the far field.
Three routes and when each is enough
| Route | Assumption | Reprojection RMS to expect | Depth behaviour | Good for |
|---|---|---|---|---|
| Air fit, transferred | Port and water ignored | Fine in air | About 24% scale miss at 1 m, plus warp | Nothing; never transfer |
| Pinhole fit, run submerged | Refraction absorbed at one depth | 2-3x the in-air RMS | Right scale near the target distance, drifts with range and angle | Pick points, obstacle avoidance |
| Refraction-aware fit | Measured t and indices, interface distance fitted | Close to in-air RMS | Metric across the working range | Measurement, photogrammetry, volume |
Route 3 is the only one that stays metric across the range. Physically parameterized flat-interface models take port thickness and indices as measured inputs and estimate the interface distance inside the fit; published formulations cover the two-cameras-one-housing case (the Pinax model), and open-source refraction-correction libraries such as AquaCal correct the depth-dependent error. Calibrate from raw image pairs, not pre-rectified ones; why stereo calibration needs raw image pairs explains the pitfall. The same decision covers a factory 3D camera mounted behind a port.
Route 2 is legitimate when the output only steers a robot: pick points, obstacle avoidance, docking. Calibrate submerged with a rigid chessboard printed on a water-stable sheet, because paper swells and quietly rescales everything. Re-measure the square pitch with calipers before the dive; pitch error biases scale directly, as the checkerboard grid pitch guide quantifies. Cover near, mid and far distances and all four corners, then verify against a taped length in the tank.
Decision: if anyone will read a millimetre off the output, route 3; if a few percent of range error is acceptable, route 2 with the 2-3x RMS budget; route 1 is never correct. If the baseline itself is still open, the stereo baseline distance guide walks the trade: wider baselines buy far-range accuracy and cost near-field overlap.
Bench checks before the housing goes in the water
The geometry you calibrate must survive handling, pressure and temperature, so the work starts on the bench. Four checks:
- Lock the focus mechanically. A flat port pulls the focused plane about 25% closer, so focus through the port at the apparent distance; locking focus before calibration shows why a moving focus voids the fit.
- Measure t at three points around the aperture; sheet acrylic varies across a panel, and t enters the model directly.
- Square the axis to the port face. A tilted axis makes the bend asymmetric, which no radially symmetric model represents.
- Fix a rigidly. Any shift of the camera relative to the port between calibration and dive changes the geometry the coefficients encode.
For the dry build, camera stands hold the housing square while you set focus and check squaring:
- Type
- Camera stands
The LS-MNT-0040 slide-table stand gives 700 mm of column height on a 400 x 450 mm base, enough to hold a housing at working height while you set focus through the port.
- Type
- Portable optical test stand (LS-MNT-S04)
- Type
- Rotary stages
A portable optical test stand carries the rig through the focus and squaring checks, and a manual X-Y-plus-rotation stage trims residual tilt under the camera. Building the bench from scratch? The stand configurator sizes one around your housing.
When a flat port is the wrong port
A concentric dome changes the physics: if the dome's center of curvature sits on the entrance pupil, every ray meets the shell along its radius, strikes both surfaces at normal incidence and passes unbent. In-air calibration then transfers almost unchanged and the FOV keeps its in-air value, which is why domes dominate wide-angle underwater optics. Centering is the whole game: a few millimetres off, and the dome reintroduces asymmetric distortion, usually worse than a flat port's. Center first; verify in water regardless.
Turbidity is the other non-starter. Suspended particles scatter light between target and port, corners lose contrast, and no calibration recovers a corner the sensor never saw cleanly. Check corner contrast at working depth before blaming the model.
For the bench side of a housing build, the stand configurator above sizes the hardware, or contact the applications team with your port geometry and depth rating.
Questions
Can I calibrate a stereo camera in air and use it underwater behind a flat port?
No. An in-air fit contains no port geometry, and the port adds roughly 25% axial compression plus a depth-dependent bend. In the worked example, a target taped at 970 mm reads about 742 mm, a 23% under-report before any angle-dependent residual. The only approximate exception is a dome port centered on the entrance pupil, and even that deserves an in-water verification before you trust the transfer.
What refractive index should I use for the water?
Use n = 1.333 for freshwater near room temperature and about 1.339 for seawater, both at visible wavelengths. Temperature moves freshwater by roughly 0.0001 per °C, well under a millimetre of apparent shift at 900 mm. Salinity matters more: about 3 mm at 900 mm, so pick the value matching the dive site and keep it consistent through the fit.
How large should the calibration target be underwater?
Big enough to reach the image corners at your nearest and farthest calibration distances. With a 58° underwater field of view and a mid-range near 750 mm, a board roughly 600 mm wide with 75 mm squares gives 600 / 75 = 8 columns, enough corners for a stable fit. Print it on a rigid, water-stable sheet and re-measure the pitch with calipers; paper swells and quietly rescales everything.
Does a dome port remove refraction completely?
Only when the dome's center of curvature sits on the entrance pupil, so every ray meets the shell at normal incidence and passes without bending. A few millimetres off-center, the dome reintroduces asymmetric distortion that is usually worse than a flat port's. Center the camera in the dome first, then confirm with a submerged target before transferring any in-air calibration.
Why does reprojection error stay high no matter how many frames I capture?
Because the residual is systematic, not random. A pinhole-plus-radial model cannot represent a bend whose strength changes with object depth, so every frame carries the same bias and averaging cannot remove it. More frames only tighten the confidence interval around the wrong answer. Change the model, meaning a refraction-aware fit, or accept the elevated error deliberately for guidance-only use.


