pupil-detectors 2.0.2

Last updated:

0 purchases

pupil-detectors 2.0.2 Image
pupil-detectors 2.0.2 Images
Add to Cart

Description:

pupildetectors 2.0.2

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 [email protected]:pupil-labs/pupil-detectors.git
cd pupil-detectors

# Install from source
pip install .

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.