Skip to main content

cheshm

PyPI version Downloads License DOI

Cheshm is a cross-platform (Linux, macOS, Windows) C++ library with Python bindings. It packages pupil, glint, and limbus detectors for grayscale eye images, plus rigid alignment of two eye images (glint, pupil, or iris-texture based) and helpers for saving the resulting visualizations to PNG.

To annotate eye images with cheshm's detectors, see EyE Annotation Tool.

cheshm GUI

Install

uv add cheshm

or with pip:

pip install cheshm

Detectors

Kind Detector Paper Licence
pupil Simple — MIT
pupil Starburst Li, Winfield, Parkhurst 2005 GPL
pupil Swirski2D Świrski, Bulling, Dodgson 2012 MIT
pupil ExCuSe Fuhl et al. 2015 non-commercial
pupil ElSe Fuhl et al. 2016 non-commercial
pupil PuRe Santini, Fuhl, Kasneci 2018 non-commercial
pupil PuReST Santini, Fuhl, Kasneci 2018 non-commercial
pupil PupilLabs2D Kassner, Patera, Bulling 2014 LGPL-3.0-or-later
glint Simple — MIT
limbus Daugman integro-differential Daugman 1993 MIT
limbus Daugman active contour Daugman 2007 MIT
limbus Pupil-guided active contour Daugman 2007 variant MIT

The top-level LICENSE is MIT and covers the framework code; each detector ships its own LICENSE file with the detector's terms. Installing the project from PyPI installs all detectors, but only the ones you import are loaded into your process — so the licence that governs your use is the licence of the detectors you imported:

from cheshm.pupil_detectors.Simple import detect_pupil       # MIT
from cheshm.pupil_detectors.Starburst import detect_pupil    # GPL
from cheshm.pupil_detectors.ExCuSe import detect_pupil       # non-commercial
from cheshm.pupil_detectors.ElSe import detect_pupil         # non-commercial
from cheshm.pupil_detectors.PuRe import detect_pupil         # non-commercial
from cheshm.pupil_detectors.PuReST import PuReST             # non-commercial (stateful tracker)
from cheshm.pupil_detectors.PupilLabs2D import detect_pupil  # LGPL-3.0
from cheshm.glint_detectors.Simple import detect_glints      # MIT
from cheshm.limbus_detectors.daugman.integro_differential import detect_limbus  # MIT
from cheshm.limbus_detectors.daugman.active_contour import detect_limbus        # MIT
from cheshm.limbus_detectors.daugman.pupil_guided import detect_limbus          # MIT

Single-eye contract

Every public function operates on one eye at a time — a single grayscale image. Callers with two eyes call cheshm twice and combine the results.

Alignment

cheshm.align.align_eye_images(ref_img, tgt_img, ref_det, tgt_det, *, step1, step2) registers tgt_img onto ref_img with up to a two-step rigid transform. Either step can be enabled independently:

  • Step 1 (translation) anchors on glint centroids (step1="glint"), pupil centres (step1="pupil"), or is skipped (step1=None).
  • Step 2 (iris-texture refinement, optional) refines (dx, dy, theta) by minimising mean absolute intensity difference inside an iris-barrel mask built from the limbus + pupil geometry.

Set step1="glint", step2=False for pure glint alignment, step1="pupil", step2=False for pure pupil-centre alignment, step1=None, step2=True for iris-only, or any combination.

Visualization

cheshm.viz writes PNGs that show detector and alignment outputs:

  • save_detection_overlay(out_path, img, detections, *, style, label) — draws pupil, glint, and limbus overlays on img. style is a dict keyed by element (pupil_contour, pupil_ellipse, pupil_center, pupil_mask, glint_contour, glint_ellipse, glint_center, limbus_curve, limbus_center) where each value is {show, color, thickness, alpha}.
  • save_diff_heatmap(out_path, ref, aligned) — colour-mapped |ref − aligned|.
  • save_alignment_overlay(out_path, ref, aligned) — blended reference + aligned image.
  • save_alignment_comparison(out_path, ref, target, aligned) — 4-panel: ref | aligned | diff-before | diff-after.

GUI

cheshm-gui opens a Dear PyGui workbench for tuning detector parameters interactively on a folder of images.

cheshm-gui                       # empty workbench
cheshm-gui path/to/folder        # open a folder of eye images
cheshm-gui path/to/a.png p2.png  # open specific files

Development

Cheshm ships precompiled wheels on PyPI for Linux, macOS, and Windows on Python 3.10–3.13, so end users never need to build anything. This section is for users who want to build from source. Building from source needs CMake, a C++20 compiler, OpenCV, and (for PupilLabs2D) Eigen3.

The project uses uv for environment management and scikit-build-core to drive CMake. First-time setup:

cd path/to/cheshm
uv sync

This creates .venv/, installs runtime + build deps, and builds the C++ extensions in editable mode (per [tool.scikit-build] in pyproject.toml).

After changing any C/C++ source, force a recompile:

uv sync --reinstall-package cheshm

Plain uv sync will not notice C/C++ source edits — only pyproject.toml changes.

After changing a binding's signature (a core.cpp under bindings/python/src/), regenerate the matching _core.pyi:

./scripts/regen_stubs.sh

Commit the updated .pyi alongside the .cpp. CI verifies the committed stubs match what stubgen would emit and fails the PR if they drift.

Repo layout

include/cheshm/         public C++ headers (libcheshm_cpp)
  helpers/              shared image-processing helpers (edges, ellipses, image, shape)
  pupil/<Det>/          per-pupil-detector headers
  glint/Simple/         per-glint-detector headers
  limbus/Daugman/       Daugman family (active_contour, integro_differential, pupil_guided)
  align/                rigid alignment headers
  viz/                  visualization headers
src/                    C++ algorithm implementations
bindings/python/
  cheshm/               Python package (PyPI)
  src/                  nanobind C++ glue, one CMake per detector
third_party/poolstl/    vendored parallel-STL backend

Name

In Persian (Farsi), Cheshm (چشم) literally means "eye".

The nazar / cheshm amulet image is from pngegg.

Acknowledgments

This work received funding from the European Union's Horizon Europe research and innovation funding program under grant agreement No 101072410, Eyes4ICU project.

Funded by EU Eyes4ICU

Metadata

Release files for cheshm 2.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cheshm 2.5.0
File Size Uploaded
cheshm-2.5.0.tar.gz 3.3 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for cheshm 2.5.0
File
cheshm-2.5.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
cheshm-2.5.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details
cheshm-2.5.0-cp313-cp313-macosx_15_0_x86_64.whl CPython 3.13 CPython 3.13 macOS 15.0+ x86-64 Details
cheshm-2.5.0-cp313-cp313-macosx_14_0_arm64.whl CPython 3.13 CPython 3.13 macOS 14.0+ ARM64 Details
cheshm-2.5.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
cheshm-2.5.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
cheshm-2.5.0-cp312-cp312-macosx_15_0_x86_64.whl CPython 3.12 CPython 3.12 macOS 15.0+ x86-64 Details
cheshm-2.5.0-cp312-cp312-macosx_14_0_arm64.whl CPython 3.12 CPython 3.12 macOS 14.0+ ARM64 Details
cheshm-2.5.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
cheshm-2.5.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
cheshm-2.5.0-cp311-cp311-macosx_15_0_x86_64.whl CPython 3.11 CPython 3.11 macOS 15.0+ x86-64 Details
cheshm-2.5.0-cp311-cp311-macosx_14_0_arm64.whl CPython 3.11 CPython 3.11 macOS 14.0+ ARM64 Details
cheshm-2.5.0-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
cheshm-2.5.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
cheshm-2.5.0-cp310-cp310-macosx_15_0_x86_64.whl CPython 3.10 CPython 3.10 macOS 15.0+ x86-64 Details
cheshm-2.5.0-cp310-cp310-macosx_14_0_arm64.whl CPython 3.10 CPython 3.10 macOS 14.0+ ARM64 Details

Total release size: 294.1 MB

Release files / cheshm-2.5.0.tar.gz

Download URL cheshm-2.5.0.tar.gz
Size 3.3 MB
Tags Source
SHA-256 checksum
How to use checksums
3c07a2c3234fc6e0ddefc7e298041030951d42ff19a19d5c50d526000c25974a
BLAKE2b-256 checksum
How to use checksums
a38000098811bc6cfa92012e13a5d7174e4e7436ac4267e8194f3812363efaa1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / cheshm-2.5.0-cp313-cp313-win_amd64.whl

Download URL cheshm-2.5.0-cp313-cp313-win_amd64.whl
Size 1.8 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
b5dd27f4c74656c4cfefd0ae78babe931e615d023b6d9406890c0aa1b043f7a2
BLAKE2b-256 checksum
How to use checksums
c15716ffb6da89f88787c65b5b9a792bed3261882bd226b4726b7b54970fc780
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / cheshm-2.5.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL cheshm-2.5.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 21.5 MB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
0d885f02bc187c97543417a1f7ecbd06d9d854407cf2fe629d73c570ccc753a5
BLAKE2b-256 checksum
How to use checksums
5962b10492cb399221be9cd1d46676e6b17e1a327ea5f750d0488f942693db09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / cheshm-2.5.0-cp313-cp313-macosx_15_0_x86_64.whl

Download URL cheshm-2.5.0-cp313-cp313-macosx_15_0_x86_64.whl
Size 33.4 MB
Tags CPython 3.13 macOS 15.0+ x86-64
SHA-256 checksum
How to use checksums
f51b14cfc2e0724feff479d982dae9f6310f5597a92dc7dbfa32ef91434b67f2
BLAKE2b-256 checksum
How to use checksums
9490a27502cf25abc360da9e4a66fe25f4b970f54187536944e006b0efcaca2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / cheshm-2.5.0-cp313-cp313-macosx_14_0_arm64.whl

Download URL cheshm-2.5.0-cp313-cp313-macosx_14_0_arm64.whl
Size 15.9 MB
Tags CPython 3.13 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
12da5217a8a7c21b0a4cd6543cc53238e018855387cfd0eb0893aca0034348aa
BLAKE2b-256 checksum
How to use checksums
f8d0d674ea3b6550e8ae09b8e6243838c75f4e44cf11dde06fc22fab963833d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / cheshm-2.5.0-cp312-cp312-win_amd64.whl

Download URL cheshm-2.5.0-cp312-cp312-win_amd64.whl
Size 1.8 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
dc2fb668554078639d8867159351f8f082cab62379da780081b2dba80e676b20
BLAKE2b-256 checksum
How to use checksums
1ab1e35b282162c745fe35283f2c96ebe52885b31829eed1d7062ab0980827c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / cheshm-2.5.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL cheshm-2.5.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 21.5 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
502a6c858fcf9a42107ede422168c61a6886be5c0586c8291b156a2690ffc716
BLAKE2b-256 checksum
How to use checksums
b88d62d8a181b08f044da67e1692464491486a0b140137c394a6fe7ab730312c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / cheshm-2.5.0-cp312-cp312-macosx_15_0_x86_64.whl

Download URL cheshm-2.5.0-cp312-cp312-macosx_15_0_x86_64.whl
Size 33.4 MB
Tags CPython 3.12 macOS 15.0+ x86-64
SHA-256 checksum
How to use checksums
5d71713d5bcff65faee97d22bb8ee70e8e3d99f644c669e314ab34259ada2f0d
BLAKE2b-256 checksum
How to use checksums
176764f4473ecf6476975e20802e8111ee162c1430f20ca048e05e26eca94d11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / cheshm-2.5.0-cp312-cp312-macosx_14_0_arm64.whl

Download URL cheshm-2.5.0-cp312-cp312-macosx_14_0_arm64.whl
Size 15.9 MB
Tags CPython 3.12 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
61c68df31861ff16e724ebe81acce36caf3067b9e7e165d830bc12d204158fe6
BLAKE2b-256 checksum
How to use checksums
4080cc4127e8a513105748562a43995c08c5d028d50a51b389b3c90d3b419bb1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / cheshm-2.5.0-cp311-cp311-win_amd64.whl

Download URL cheshm-2.5.0-cp311-cp311-win_amd64.whl
Size 1.8 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
8f08ae94d57fa729b577c258414bb54c8bf4a65a1e85752e069c855c2d6c0898
BLAKE2b-256 checksum
How to use checksums
af20f4d2664a452222e35a2f1a7aff51d732f9bbd5224ef88eb349b088e89047
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / cheshm-2.5.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL cheshm-2.5.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 21.5 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
d21e5c85d8e7000b8cbc116b91b3b8e56ad9cc76452fe448feb913f7f115c5ff
BLAKE2b-256 checksum
How to use checksums
7eec3ca6413f656a3ea8a0ba3637d8761b3289d5cff955ebb498cb823cd74594
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / cheshm-2.5.0-cp311-cp311-macosx_15_0_x86_64.whl

Download URL cheshm-2.5.0-cp311-cp311-macosx_15_0_x86_64.whl
Size 33.4 MB
Tags CPython 3.11 macOS 15.0+ x86-64
SHA-256 checksum
How to use checksums
0a2e8e8e2965a4b9bd2d3ea92d1c5a996c531b096407017ef8c1fa5a3939a7cd
BLAKE2b-256 checksum
How to use checksums
f7d1c177bd641e6a9e7e2b1f6c87de614be75da4a0f30a1e51053d163a1168d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / cheshm-2.5.0-cp311-cp311-macosx_14_0_arm64.whl

Download URL cheshm-2.5.0-cp311-cp311-macosx_14_0_arm64.whl
Size 15.9 MB
Tags CPython 3.11 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
754b06c201b3cf9e29509cfda26fea818aff6e2d8502fdb0d4f1f958f5aec764
BLAKE2b-256 checksum
How to use checksums
b96b079b46ce22b629331d74915fd3e027a6619fa07f785ef860da43b397a894
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / cheshm-2.5.0-cp310-cp310-win_amd64.whl

Download URL cheshm-2.5.0-cp310-cp310-win_amd64.whl
Size 1.8 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
01f697c2983d614adea5f29dd70b754928bc46378d647a93a6cc67d2a10983ab
BLAKE2b-256 checksum
How to use checksums
1fcee63d150dc8c3e92f0f3c368028d5402a67bac5899773dc497260735028f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / cheshm-2.5.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL cheshm-2.5.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 21.6 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
0361a6e52e1495e9d11206baf8cd33e0934523ab52def0ad5f169735d93d9c45
BLAKE2b-256 checksum
How to use checksums
7a56515997d5125c1d5ef61235f4385342e9b04b21de57ed3b5680fcc08f45c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / cheshm-2.5.0-cp310-cp310-macosx_15_0_x86_64.whl

Download URL cheshm-2.5.0-cp310-cp310-macosx_15_0_x86_64.whl
Size 33.4 MB
Tags CPython 3.10 macOS 15.0+ x86-64
SHA-256 checksum
How to use checksums
60f91ed9515ebd3b96386f8b150c1059e15e615177a843f35c74ac7a356d8a12
BLAKE2b-256 checksum
How to use checksums
85ee1e13ba24e36b309399443002c7c871781be278ef0083ed4c5ff8da5c7e45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / cheshm-2.5.0-cp310-cp310-macosx_14_0_arm64.whl

Download URL cheshm-2.5.0-cp310-cp310-macosx_14_0_arm64.whl
Size 15.9 MB
Tags CPython 3.10 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
391a90b2a8fff74c52d980d377b106182c3661c921271bbce8bfaae653b67f7c
BLAKE2b-256 checksum
How to use checksums
cf585180407c22c7a9897047cc60a662d0ad35155782d72e3e94a181dbe423ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

2.5.0 This release

17 release files

2.4.1

17 release files

2.4.0

17 release files

2.0.1

17 release files

2.0.0

17 release files

1.0.0

17 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page