Skip to content

test: expose camera geometry assertion failures - #143

Open
RoboX2020 wants to merge 1 commit into
petercorke:mainfrom
RoboX2020:test/camera-assertions
Open

RoboX2020 wants to merge 1 commit into
petercorke:mainfrom
RoboX2020:test/camera-assertions

Conversation

@RoboX2020

Copy link
Copy Markdown

Addresses the camera test part of #115. Remove all 11 bare except blocks in tests/test_camera.py and check actual geometry instead of hiding errors.

The old tests included a wrong single-point shape, row-oriented world points, a Line3 treated as a 3-vector, a nonexistent P() method, and a skipped move test with undefined variables. The rewritten checks cover:

  • Focal-length and principal-point setters.
  • Analytic pinhole projection for one and several points.
  • Distortion parameter storage.
  • Rays through the camera centre with known directions.
  • Absolute and relative move results, without changing the original camera.
  • Analytic calibration/extrinsic matrices and projection consistency.
  • A separately constructed camera's pose independence.

No production code changes.

Validation on Python 3.11:

  • Camera suite: 25 passed plus 2 subtests on OpenCV 4.12.0.88 and 5.0.0.93.
  • Full OpenCV 5 suite: 960 passed, 96 skipped, 7 subtests passed.
  • Seven targeted mutations fail the corresponding rewritten checks (ignored setter, bad projection, wrong ray origin, in-place move, zero projection matrix, lost distortion, shared pose).
  • Changed file passes ruff and black.

Full suite on OpenCV 4 was not run. Other #115 files are separate.

Use direct analytic assertions for camera parameters, projection, rays, matrices, and returned camera poses.
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics -11 complexity · 0 duplication

Metric Results
Complexity -11
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

This branch has not been deployed

No deployments
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