In this article
Convert the documented fixed-point disparity to floating pixel units before reconstruction.
The generated-data scenario
A generator renders a stereo pair, computes SGBM disparity and exports reconstructed depth as a synthetic training target. The disparity image looks plausible when colorized, but its stored numeric representation is not necessarily pixel displacement directly. Passing the integer array into reconstruction without its documented scale changes geometry while preserving the expected array shape and apparently ordinary depth output.
The generation mechanism
OpenCV documents that signed fixed-point disparity produced by StereoBM or StereoSGBM should be divided by 16 and converted to floating point before reprojectImageTo3D. The implementation applies a disparity scale to computed values. This is an encoding conversion, separate from changing camera baseline, focal length or image size. Converting integer type alone does not perform the required scaling.
Define the dataset contract
Record the producer algorithm, output dtype, fixed-point scale, camera matrices, disparity validity convention and target depth unit. Distinguish rendered geometric reference from stereo-estimated pseudo-labels. Even correctly decoded stereo output is an estimate rather than automatically exact simulator truth. Preserve invalid regions separately; a finite encoded value or a successful projection call does not establish a valid correspondence.
A step-by-step protocol
Use a controlled stereo fixture with known camera configuration and valid correspondences. Trace the stored disparity through the conversion and reconstruction stages, checking that the factor 16 is applied exactly where required. Compare an intentionally unscaled control. Inspect selected coordinates numerically against the declared geometry rather than relying on a normalized display that can conceal a global scale error.
Evidence required for acceptance
Acceptance requires the actual disparity encoding, conversion record, reconstruction parameters and target-unit checks on valid pixels. Retain invalid masks and explain differences from simulator geometry instead of relabeling every discrepancy as conversion failure. A second conversion applied by a loader can undo a correct export, so inspect the student-facing target after serialization and ingestion as well as the generator intermediate.
Failure cases and limits
The scale described belongs to the documented fixed-point output, not every disparity representation or external neural estimator. Do not divide an already decoded floating map again. Occlusion, matching errors and camera mistakes require separate evaluation. This proposed check establishes representation consistency; it supplies no measured stereo accuracy and does not turn algorithm-derived labels into independently verified physical depth.
Primary references and related reading
Convert the documented fixed-point disparity to floating pixel units before reconstruction. OpenCV stereo disparity scale and camera matrices; OpenCV SGBM scaled-disparity implementation.
The proposed investigation of opencv sgbm fixed point synthetic depth is a proposed dataset-contract review; no production dataset was generated or evaluated. Related reading: Original TartanAir depth: metric distance and stereo disparity are different targets; Depth Pro focal length: a camera value must match the image pixel grid.
Earn rental income from GPUs
Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.