Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "caliscope"
version = "0.11.2"
version = "0.11.3"
description = "Rapid and reliable multicamera calibration with GUI and scripting API"
authors = [{name = "Mac Prible", email = "prible@gmail.com"}]
license = { text = "BSD-2-Clause" }
Expand Down
8 changes: 6 additions & 2 deletions src/caliscope/core/calibrate_intrinsics.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,11 @@ def calibrate_intrinsics(
obj_pts = [p.astype(np.float32) for p in obj_points_list]
img_pts = [p.astype(np.float32) for p in img_points_list]

# Pre-initialize output matrices (required by type checker, works at runtime)
camera_matrix = np.zeros((3, 3), dtype=np.float64)
camera_matrix = np.eye(3, dtype=np.float64)
camera_matrix[0, 0] = max(width, height)
camera_matrix[1, 1] = max(width, height)
camera_matrix[0, 2] = (width - 1) * 0.5
camera_matrix[1, 2] = (height - 1) * 0.5
dist_coeffs = np.zeros(5, dtype=np.float64)

error, mtx, dist, rvecs, tvecs = cv2.calibrateCamera(
Expand All @@ -162,6 +165,7 @@ def calibrate_intrinsics(
(width, height),
camera_matrix,
dist_coeffs,
flags=cv2.CALIB_USE_INTRINSIC_GUESS,
)
# calibrateCamera returns dist as (1, 5), flatten it
dist = dist.ravel()
Expand Down
4 changes: 2 additions & 2 deletions src/caliscope/trackers/charuco_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ def find_corners_single_frame(self, gray_frame, mirror):
except Exception as e:
logger.debug(f"Sub pixel detection failed: {e}")

ids = _ids[:, 0]
img_loc = _img_loc[:, 0]
ids = _ids.squeeze()
img_loc = _img_loc.squeeze(axis=1) if _img_loc.ndim == 3 else _img_loc

# flip coordinates if mirrored image fed in
frame_width = gray_frame.shape[1]
Expand Down
3 changes: 1 addition & 2 deletions tests/test_calibrate_intrinsics.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ def test_calibrate_returns_valid_result(self):
"""Calibration produces reasonable camera matrix and distortions."""
image_points, cam0_frames = _load_test_data()

# Use first 20 frames for calibration
selected = cam0_frames[:20]
selected = cam0_frames[:30]

result = calibrate_intrinsics(
image_points,
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.