Skip to main content

Pupil Labs 2D Pupil Detector

None None

Project description

https://img.shields.io/pypi/v/pupil-detectors.svg https://img.shields.io/pypi/pyversions/pupil-detectors.svg tests Code style: Black https://img.shields.io/badge/skeleton-2022-informational

pupil-detectors

This Python package contains the standalone 2D pupil detectors for the Pupil Core software stack.

Install via PyPI

pip install pupil-detectors

Usage

Here’s a quick example on how to detect and draw an ellipse.

import cv2
from pupil_detectors import Detector2D

detector = Detector2D()

# read image as numpy array from somewhere, e.g. here from a file
img = cv2.imread("pupil.png")
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

result = detector.detect(gray)
ellipse = result["ellipse"]

# draw the ellipse outline onto the input image
# note that cv2.ellipse() cannot deal with float values
# also it expects the axes to be semi-axes (half the size)
cv2.ellipse(
   img,
   tuple(int(v) for v in ellipse["center"]),
   tuple(int(v / 2) for v in ellipse["axes"]),
   ellipse["angle"],
   0, 360, # start/end angle for drawing
   (0, 0, 255) # color (BGR): red
)
cv2.imshow("Image", img)
cv2.waitKey(0)

Developers

Building from Source

Installing the dependencies

  • macOS: brew install eigen opencv

  • Windows: choco install eigen opencv

  • Ubuntu: apt-get install libeigen3-dev libeigen3-dev

Building the Python package

# Clone repository
git clone git@github.com:pupil-labs/pupil-detectors.git
cd pupil-detectors

# Install from source
pip install .

Project details

None None

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pupil_detectors-2.0.2.tar.gz (69.6 kB view hashes)

Uploaded Source

Built Distributions

pupil_detectors-2.0.2-cp311-cp311-win_amd64.whl (23.6 MB view hashes)

Uploaded CPython 3.11 Windows x86-64

pupil_detectors-2.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (20.3 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

pupil_detectors-2.0.2-cp311-cp311-macosx_10_9_x86_64.whl (27.6 MB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pupil_detectors-2.0.2-cp310-cp310-win_amd64.whl (23.6 MB view hashes)

Uploaded CPython 3.10 Windows x86-64

pupil_detectors-2.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (20.3 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

pupil_detectors-2.0.2-cp310-cp310-macosx_10_9_x86_64.whl (27.6 MB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pupil_detectors-2.0.2-cp39-cp39-win_amd64.whl (23.6 MB view hashes)

Uploaded CPython 3.9 Windows x86-64

pupil_detectors-2.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (20.3 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

pupil_detectors-2.0.2-cp39-cp39-macosx_10_9_x86_64.whl (27.6 MB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

pupil_detectors-2.0.2-cp38-cp38-win_amd64.whl (23.6 MB view hashes)

Uploaded CPython 3.8 Windows x86-64

pupil_detectors-2.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (20.3 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

pupil_detectors-2.0.2-cp38-cp38-macosx_10_9_x86_64.whl (27.6 MB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

pupil_detectors-2.0.2-cp37-cp37m-win_amd64.whl (23.6 MB view hashes)

Uploaded CPython 3.7m Windows x86-64

pupil_detectors-2.0.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (20.3 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

pupil_detectors-2.0.2-cp37-cp37m-macosx_10_9_x86_64.whl (27.6 MB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

pupil_detectors-2.0.2-cp36-cp36m-win_amd64.whl (23.6 MB view hashes)

Uploaded CPython 3.6m Windows x86-64

pupil_detectors-2.0.2-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (20.3 MB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.17+ x86-64

pupil_detectors-2.0.2-cp36-cp36m-macosx_10_9_x86_64.whl (27.6 MB view hashes)

Uploaded CPython 3.6m macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page