Skip to content

fix: OpenCV 5 compatibility - #1008

Merged
mprib merged 1 commit into
mainfrom
fix/opencv5-compat
Jul 20, 2026
Merged

fix: OpenCV 5 compatibility#1008
mprib merged 1 commit into
mainfrom
fix/opencv5-compat

Conversation

@mprib

@mprib mprib commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • Charuco detectBoard shape change: ids returned as (N,) instead of (N, 1) in OpenCV 5. Fixed with squeeze.
  • calibrateCamera solver change: OpenCV 5's Schur-complement LM converges to bad local minima without an explicit initial guess. Fixed with CALIB_USE_INTRINSIC_GUESS.
  • Intrinsic test uses 30 frames instead of 20 so the principal point is well-constrained across solver implementations.
  • Bump to 0.11.3.

Test plan

  • Full suite passes on OpenCV 4.13 (766 passed)
  • Full suite passes on OpenCV 5.0 (766 passed)
  • Type check clean (basedpyright)
  • Confirmed Schur solver root cause via CALIB_DISABLE_SCHUR_COMPLEMENT diagnostic

…ration

OpenCV 5 changed two things that broke caliscope:

1. ArUco/Charuco detectBoard returns ids as (N,) instead of (N, 1),
   and img_loc as (N, 2) instead of (N, 1, 2). The [:, 0] squeeze
   raised IndexError. Fixed with np.squeeze, which handles both shapes.

2. The default calibrateCamera solver switched to a Schur-complement LM
   (PR #28461) that converges to bad local minima with sparse data.
   Fixed by passing CALIB_USE_INTRINSIC_GUESS with a reasonable initial
   camera matrix, giving both solvers the right basin of convergence.

Intrinsic test uses 30 frames instead of 20 to ensure the principal
point is well-constrained across solver implementations.

Bump to 0.11.3.
@mprib
mprib merged commit ad12ec9 into main Jul 20, 2026
5 checks passed
@mprib
mprib deleted the fix/opencv5-compat branch July 20, 2026 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant