Skip to content

chore: annotate Camera and document the camera base class - #256

Merged
petercorke merged 2 commits into
mainfrom
chore/types-camera
Nov 23, 2026
Merged

petercorke merged 2 commits into
mainfrom
chore/types-camera

Conversation

@petercorke

Copy link
Copy Markdown
Owner

Annotates Camera.py, the next file in the type-hint work of Issue 60 (14 of 177 parameters and 1 of 97 returns were unannotated). Annotation and docstring changes only, no behaviour change.

  • The **kwargs of the CentralCamera, FishEyeCamera and CatadioptricCamera constructors, project_point, plot_point(*fmt), points2H, points2F and points2E are Any. CameraBase.project_point(P) takes np.ndarray | ArrayLike, as its overrides do. images2C(images=) takes Iterable[Image], and its return is tuple[np.ndarray, np.ndarray, list[Any]] | None. points2F returns a list whose length depends on its options (the matrix, then optionally the residual and the inlier mask), so it is list[Any].
  • Typing images2C showed that ret held the "chessboard found" flag and then, after cv2.calibrateCamera, the calibration error, which mypy rejects as a bool assigned a float. The second is now rms. The value and the if rms: test are the same.
  • Docstrings: the abstract CameraBase had none and project_point, project_line and project_conic had none, and they do now.

I left alone the 64 :seealso: fields and 48 Example: blocks, which AGENTS.md says to migrate gradually.

mypy reports no issues and the full suite passes (2158 passed, 33 skipped).

AI-assisted: written with Claude Code (Claude Sonnet 5.5) and reviewed by the maintainer.

🤖 Generated with Claude Code

Part of Issue 60. Annotates the remaining parameters and returns in
Camera.py (the **kwargs of the constructors and project_point, points2H,
points2F and points2E, images2C, plot_point) and gives CameraBase and its
abstract projection methods docstrings. images2C used ret for both the
chessboard found flag and the calibration error, which mypy rejects once
the images are typed, so the second is now rms.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
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.

@petercorke
petercorke merged commit 05408cf into main Nov 23, 2026
32 checks passed
@petercorke
petercorke deleted the chore/types-camera branch November 23, 2026 08:11
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