Skip to content

Commit

Permalink
Updated intrinsic estimation to account for central offsets
Browse files Browse the repository at this point in the history
  • Loading branch information
EmanueleGiacomini committed Oct 24, 2024
1 parent 6d512cf commit e10d787
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions pyprojections/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,21 @@ def calculate_spherical_intrinsics(points: np.ndarray, image_rows: int, image_co
), axis=1)

# compute dynamic vertical fov
vertical_fov = np.max(azel[:, 1]) - np.min(azel[:, 1])
horizontal_fov = np.max(azel[:, 0]) - np.min(azel[:, 0])
vfov_max = np.max(azel[:, 1])
vfov_min = np.min(azel[:, 1])
hfov_max = np.max(azel[:, 0])
hfov_min = np.min(azel[:, 0])
# vertical_fov = np.max(azel[:, 1]) - np.min(azel[:, 1])
# horizontal_fov = np.max(azel[:, 0]) - np.min(azel[:, 0])
vertical_fov = vfov_max - vfov_min
horizontal_fov = hfov_max - hfov_min

fx = -float(image_cols - 1) / horizontal_fov
fy = -float(image_rows - 1) / vertical_fov
cx = image_cols / 2
cy = image_rows / 2
# cx = (image_cols / 2) + image_cols * (hfov_max + hfov_min) / horizontal_fov / 2
# cy = (image_rows / 2) + image_rows * (vfov_max + vfov_min) / vertical_fov / 2
cx = image_cols * (1 + (hfov_max + hfov_min) / horizontal_fov) / 2
cy = image_rows * (1 + (vfov_max + vfov_min) / vertical_fov) / 2

K = np.array([
[fx, 0, cx],
Expand Down

0 comments on commit e10d787

Please sign in to comment.