Aligning the Invisible: The Science Behind Stereo Camera Sensor Calibration
Introduction
When you look at something, your brain merges two slightly different images from your eyes to work out depth and distance without any real effort. Getting a machine to do the same thing is a lot harder. At Hoomanely, stereo vision is central to how we read depth, shape, and spatial relationships, whether that's mapping a pet's movement or estimating distance and gaze. Accurate stereo alignment is the foundation everything else depends on.
Stereo camera calibration is essentially the process of teaching two sensors to see as one. Through intrinsic and extrinsic calibration, pixel fusion, and proximity correction, we turn raw, misaligned data into precise 3D reconstructions. This post walks through the math, the engineering, and the intuition behind aligning what you can't directly see.
The problem: two eyes, two realities
Every camera has its own quirks: lens curvature, sensor size, focal length, optical center. Even two cameras mounted rigidly next to each other won't agree on what a point in space looks like. A single pixel showing a dog's left eye in the left frame might land on a slightly offset pixel in the right frame, and that small mismatch, often just a few millimeters, can badly distort depth perception.
In our case, this mattered a lot. A 2 to 3 pixel mismatch was the difference between smooth depth reconstruction and jittery, unreliable data.

Intrinsic calibration: teaching each camera about itself
Intrinsic calibration works out a camera's internal geometry: its focal length, optical center, and lens distortion. We photograph a checkerboard pattern at various angles and distances, then use OpenCV's calibration routines to solve for each camera's intrinsic matrix.

Here, f_x and f_y are the focal lengths in pixel units, and c_x, c_y mark the optical center. Correcting for lens distortion is what keeps straight lines in the real world looking straight in the image.

Extrinsic calibration: teaching the cameras about each other
Once each camera's internal behavior is known, the next question is how they relate spatially: the rotation (R) and translation (T) between them. This is extrinsic calibration, and it's what lets one camera's coordinate system map onto the other's.
For our dual-sensor rig, we captured checkerboard images from both cameras at the same time and computed the transformation matrix between them.

This relationship is what enables stereo rectification: aligning the two camera planes so that corresponding points sit on the same horizontal lines.
Pixel fusion: making two images one
With calibration done, we can merge both views into a unified coordinate space. This pixel fusion step projects points from one image into the other camera's frame using the calibration matrices, matching each point to compute a disparity map that encodes depth.
Real-world conditions, like small shifts in the sensor mount or lens expansion, introduce residual misalignment that calibration alone doesn't fully solve. To correct for that, we added a proximity-based correction step, using data from our proximity sensor to dynamically adjust the alignment scale and keep it consistent across varying object distances.
Quantitative impact: when math meets precision
Before calibration, the average pixel alignment error between stereo frames sat around 2.8 pixels RMS. After calibration, with proximity correction and rectification applied, that dropped to 0.4 pixels RMS, an improvement of nearly 85%. That precision translates directly into better depth accuracy, keeping disparity estimation consistent even with fur texture, occlusion, or motion in the frame.

Seeing the world in true depth
Accurate stereo calibration is what makes precise depth estimation possible, which matters whether we're measuring distance to a bowl, tracking movement, or estimating shape. At Hoomanely, this is one piece of a larger system that combines cameras, proximity sensors, IMUs, and microphones into a single perception pipeline. Stereo calibration lays the groundwork for that sensor fusion, so every signal lines up correctly in both time and space.

Key takeaways
- Intrinsic calibration corrects each camera's internal distortion.
- Extrinsic calibration lines the two cameras up spatially.
- Pixel fusion builds a coherent 3D view through disparity mapping.
- Proximity correction keeps depth accuracy stable across varying distances.
- The result: alignment error cut by roughly 85%, enabling reliable spatial understanding.
- Stereo calibration is one of several foundations behind Hoomanely's broader sensor fusion system, tying depth, motion, and audio together for a fuller read on pet perception.