Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use pl-neon-recording for calibration parsing #65

Merged
merged 7 commits into from
Aug 19, 2024
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ install_requires =
av
beaupy
numpy>=1.20
pl-neon-recording
pl-neon-recording>=0.1.4
pydantic>=2
websockets
zeroconf
Expand Down
21 changes: 2 additions & 19 deletions src/pupil_labs/realtime_api/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import aiohttp
import numpy as np
import websockets
from pupil_labs.neon_recording.calib import Calibration

import pupil_labs # noqa: F401

Expand Down Expand Up @@ -277,25 +278,7 @@ async def get_calibration(self) -> np.ndarray:
raise DeviceError(response.status, "Failed to fetch calibration")

raw_data = await response.read()
return np.frombuffer(
raw_data,
np.dtype(
[
("version", "u1"),
("serial", "6a"),
("scene_camera_matrix", "(3,3)d"),
("scene_distortion_coefficients", "8d"),
("scene_extrinsics_affine_matrix", "(4,4)d"),
("right_camera_matrix", "(3,3)d"),
("right_distortion_coefficients", "8d"),
("right_extrinsics_affine_matrix", "(4,4)d"),
("left_camera_matrix", "(3,3)d"),
("left_distortion_coefficients", "8d"),
("left_extrinsics_affine_matrix", "(4,4)d"),
("crc", "u4"),
]
),
)
return Calibration.from_buffer(raw_data)


class StatusUpdateNotifier:
Expand Down
Loading