Skip to content

Commit

Permalink
Assume default intrinsics if they couldn't be retrieved.
Browse files Browse the repository at this point in the history
  • Loading branch information
zrezke committed Apr 4, 2024
1 parent 80c26be commit bd9ab1d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions rerun_py/depthai_viewer/_backend/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,14 @@ def get_intrinsic_matrix(self, board_socket: dai.CameraBoardSocket, width: int,
return self.intrinsic_matrix.get((board_socket, width, height)) # type: ignore[return-value]
if self.calibration_data is None:
raise Exception("Missing calibration data!")
M_right = self.calibration_data.getCameraIntrinsics( # type: ignore[union-attr]
board_socket, dai.Size2f(width, height)
)
try:
M_right = self.calibration_data.getCameraIntrinsics( # type: ignore[union-attr]
board_socket, dai.Size2f(width, height)
)
except RuntimeError:
print("No intrinsics found for camera: ", board_socket, " assuming default.")
f_len = (height * width) ** 0.5
M_right = [[f_len, 0, width / 2], [0, f_len, height / 2], [0, 0, 1]]
self.intrinsic_matrix[(board_socket, width, height)] = np.array(M_right).reshape(3, 3)
return self.intrinsic_matrix[(board_socket, width, height)]

Expand Down

0 comments on commit bd9ab1d

Please sign in to comment.