﻿# An undistortion ROI crop changes the camera origin of synthetic labels

A practical investigation of an undistortion ROI crop changes the camera origin of synthetic labels, with explicit observations, control cases and evidence limits.

Author: Retrivium team
Updated: 2026-11-06
Canonical URL: https://retrivium.ai/journal/field-synthetic-opencv-undistort-roi-crop-principal-point/
Language: en

## The generated-data scenario

A synthetic camera dataset undistorts rendered images with a new camera matrix, then crops the valid ROI and exports the unchanged matrix. Straight lines look correct, yet downstream projection uses the origin of the uncropped result. The research question is whether image coordinates and exported calibration still describe the same representation after this additional array operation.

## The generation mechanism

OpenCV returns a new camera matrix and valid-pixel ROI through getOptimalNewCameraMatrix. Its calibration tutorial applies undistortion using that matrix and subsequently crops the image array to the ROI. The crop is a separate operation. By the image-coordinate projection relation, moving the origin requires subtracting the crop offset from the principal-point coordinates; this is a coordinate deduction, not an automatic crop guarantee.

## Define the dataset contract

Preserve original calibration, undistorted calibration, ROI origin and final image dimensions as distinct stages. Define which stage every annotation and camera matrix belongs to. A pure crop changes the origin but does not itself rescale focal lengths. If the pipeline subsequently resizes the crop, record that additional scale separately rather than applying an unexplained correction to all camera values.

## A step-by-step protocol

Build a scene with known projected landmarks away from the image center. Save the uncropped undistorted image and its projections. Apply the actual ROI crop, translate the projected coordinates and derive matching final intrinsics. Overlay the landmarks on the final pixels. Include a stale-matrix control so the acceptance check can reveal an origin mismatch rather than merely verifying that matrices have expected dimensions.

## Evidence required for acceptance

Acceptance requires the full coordinate chain, actual ROI offset, final dimensions and agreement of projected landmarks with the cropped image. Round-trip checks must use independent known correspondences rather than the same incorrect transform in both directions. Verify the calibration and labels delivered by the student loader, because an adapter may already account for cropping and an added correction could apply it twice.

## Failure cases and limits

This review does not estimate calibration accuracy from synthetic appearance or claim every returned ROI is nonempty and suitable for all uses. Distortion models, rectification and later rotations need their own transformations. The protocol addresses a specific origin change after undistortion, complementing focal-length unit checks. It supplies no measured reconstruction error or guarantee that simulated calibration transfers to a physical camera.

## Primary references and related reading

Translate the principal point when a later ROI crop changes the image origin. [OpenCV stereo disparity scale and camera matrices](https://docs.opencv.org/4.13.0/d9/d0c/group__calib3d.html); [OpenCV undistortion and later ROI cropping](https://docs.opencv.org/4.13.0/dc/dbb/tutorial_py_calibration.html).

The proposed investigation of opencv undistort roi crop principal point is a proposed dataset-contract review; no production dataset was generated or evaluated. Related reading: [Depth Pro focal length: a camera value must match the image pixel grid](/journal/fg2-depthpro-focal-length-pixel-contract/); [PDF citations: keep page coordinates correct after rotation and cropping](/journal/pdf-citation-coordinates-rotation-crop/).
