Pupil Labs Camera
This repo contains functionality around the usage of camera intrinsics for undistorting data, projecting and unprojecting points.
It is mostly a wrapper around OpenCV's functionality, providing type hints, input validation, a more intuitive interface, and a few performance optimizations.
Installation
pip install pupil-labs-camera
or
pip install -e git+https://github.com/pupil-labs/pl-camera.git
Quick Start
The following code demonstrates how to use the library in the context of a Neon recording to undistort an image and 2D gaze points. Additional examples can be found in the example Jupyter Notebook.
import cv2
from pupil_labs import neon_recording as nr
from pupil_labs.camera import Camera
recording = nr.NeonRecording(
"/path/to/recording"
)
camera = Camera(
pixel_width=1600,
pixel_height=1200,
camera_matrix=recording.calibration.scene_camera_matrix,
distortion_coefficients=recording.calibration.scene_distortion_coefficients,
)
data = zip(recording.scene, recording.gaze.sample(recording.scene.time))
for scene_frame, gaze_sample in data:
distorted_image = scene_frame.bgr
undistorted_image = camera.undistort_image(distorted_image)
distorted_gaze = gaze_sample.point
undistorted_gaze = camera.undistort_points(distorted_gaze)
cv2.circle(
distorted_image,
tuple(map(int, distorted_gaze)),
radius=25,
color=(0, 0, 255),
thickness=5,
)
cv2.circle(
undistorted_image,
tuple(map(int, undistorted_gaze)),
radius=25,
color=(0, 255, 0),
thickness=5,
)
cv2.imshow("Distorted Image", distorted_image)
cv2.imshow("Undistorted Image", undistorted_image)
cv2.waitKey(30)
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pupil_labs_camera-1.2.1.tar.gz.
File metadata
- Download URL: pupil_labs_camera-1.2.1.tar.gz
- Upload date:
- Size: 1.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29cbff5b9c7b31d7e034be8086ceeb5e71d24ed681257625ec97156981781c6f
|
|
| MD5 |
05237ea6aa326f301081e269754f64ad
|
|
| BLAKE2b-256 |
4c3c2dd77dc52009886dacd6edcb44da2c7cd941be60685bf55a8165fc867743
|
Provenance
The following attestation bundles were made for pupil_labs_camera-1.2.1.tar.gz:
Publisher:
on-release-main.yml on pupil-labs/pl-camera
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pupil_labs_camera-1.2.1.tar.gz -
Subject digest:
29cbff5b9c7b31d7e034be8086ceeb5e71d24ed681257625ec97156981781c6f - Sigstore transparency entry: 2674458185
- Sigstore integration time:
-
Permalink:
pupil-labs/pl-camera@a5dad897286614788191c288ebe5c2e9a28461f2 -
Branch / Tag:
refs/tags/v1.2.1 - Owner: https://github.com/pupil-labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
on-release-main.yml@a5dad897286614788191c288ebe5c2e9a28461f2 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pupil_labs_camera-1.2.1-py3-none-any.whl.
File metadata
- Download URL: pupil_labs_camera-1.2.1-py3-none-any.whl
- Upload date:
- Size: 185.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3f66bba702ea1a029a7baace5871a9614dfa06489f5b6f9814c24c2ae32e0b0
|
|
| MD5 |
675993894a73c102d04a2537e98ccbdf
|
|
| BLAKE2b-256 |
7cec8fbc0895c4ecfb529d7b9b77fb436434aa50a06b13a5b2683d43ff8e0cd7
|
Provenance
The following attestation bundles were made for pupil_labs_camera-1.2.1-py3-none-any.whl:
Publisher:
on-release-main.yml on pupil-labs/pl-camera
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pupil_labs_camera-1.2.1-py3-none-any.whl -
Subject digest:
b3f66bba702ea1a029a7baace5871a9614dfa06489f5b6f9814c24c2ae32e0b0 - Sigstore transparency entry: 2674458262
- Sigstore integration time:
-
Permalink:
pupil-labs/pl-camera@a5dad897286614788191c288ebe5c2e9a28461f2 -
Branch / Tag:
refs/tags/v1.2.1 - Owner: https://github.com/pupil-labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
on-release-main.yml@a5dad897286614788191c288ebe5c2e9a28461f2 -
Trigger Event:
release
-
Statement type: