This is a python-package containing standalone pupil detectors for the Pupil-Labs software stack. It contains the following detectors:
macOS and Linux
This package has a couple of non-python dependencies that you will have to install yourself before you can install pupil-detectors. We are working on clean setup instructions, but until then you can just install all dependencies from the Pupil software stack. You can find installation guides on the Pupil GitHub page (section: Installing Dependencies).
Then you can install pupil-detectors with pip:
pip install pupil-detectors
Since the dependency setup is very complex on Windows, we provide prebuilt-wheels. This means you don't have to install any dependencies and can just install pupil-detectors:
pip install pupil-detectors
If you don't want to use our prebuilt versions, see the section Building from Source further below.
Here's a quick example on how to detect and draw an ellipse.
import cv2 from pupil_detectors import Detector2D, Detector3D 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)
Building from Source
You can install this package locally from source. Make sure you have all necessary dependencies setup (see Installation section above).
NOTE: For Windows the dependency setup is quite complex. Until we have clean instructions, please follow the guide for setting up Windows dependencies for Pupil.
NOTE: When building the package on your own, you can experience severe performance differences when not having setup your dependencies correctly. Make sure to compare performance to prebuilt wheels or to bundled versions of Pupil.
# Clone repository git clone firstname.lastname@example.org:pupil-labs/pupil-detectors.git cd pupil-detectors # Install from source with development extras pip install ".[dev]" # Run tests pytest tests
This project does not currently support automated distribution. Steps for a new release:
- Make sure the code works.
- Install dependencies
pip install bump2version twine
- Run bump2version (major/minor/patch). This will bump the version, create a new commit and a new tag! Git must be clean of modifications.
- Push the new commit and (all) tags.
git push --tags
- Build the source distribution and upload to PyPI.
python setup.py sdist twine upload ./dist/*
- Build wheels and upload to PyPi. Use the internal bundle-machines for Pupil for the correct dependency setup!
pip wheel --no-deps . -w dist twine upload ./dist/*
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size pupil_detectors-1.0.2-cp36-cp36m-win_amd64.whl (14.6 MB)||File type Wheel||Python version cp36||Upload date||Hashes View hashes|
|Filename, size pupil-detectors-1.0.2.tar.gz (381.9 kB)||File type Source||Python version None||Upload date||Hashes View hashes|
Hashes for pupil_detectors-1.0.2-cp36-cp36m-win_amd64.whl