Skip to content

Fix pupil overflow and cross-platform tracker bugs - #19

Open
OpenNerdz wants to merge 1 commit into
JEOresearch:mainfrom
OpenNerdz:fix/cross-platform-and-pupil-detection-bugs
Open

Fix pupil overflow and cross-platform tracker bugs#19
OpenNerdz wants to merge 1 commit into
JEOresearch:mainfrom
OpenNerdz:fix/cross-platform-and-pupil-detection-bugs

Conversation

@OpenNerdz

@OpenNerdz OpenNerdz commented Jul 31, 2026

Copy link
Copy Markdown

Summary

Fixes a few correctness bugs in the 3D pupil trackers and makes Head/Webcam tooling work more reliably outside Windows.

Pupil / stereo tracking

  • Cast gray-pixel sums and thresholds to int so uint8 overflow no longer corrupts darkest-area search (search region could jump or lock onto the wrong spot).
  • Fix contour length check: len(arr > 5)len(arr) > 5.
  • Call draw_stuck_ellipses() in the stereo tracker so E/C ellipse capture actually draws.
  • Soft-skip frames when no darkest point is found instead of crashing.

Cross-platform

  • Mono/front camera open no longer forces CAP_MSMF (Windows-only); non-Windows uses CAP_ANY.
  • HeadTracker and Webcam3DTracker: replace keyboard package with OpenCV waitKey (toggle mouse with m; no root on Linux/macOS).
  • Webcam3DTracker writes screen_position.txt next to the script instead of a hardcoded C:/... path.
  • Pupil detectors prefer local eye_test.mp4 / local output paths.
  • Pin MediaPipe to >=0.10.5,<0.10.15 so solutions.face_mesh still installs cleanly.

Test plan

  • Compile modified modules
  • Headless smoke on eye_test.mp4 (stereo + mono; no overflow warnings)
  • Manual: stereo tracker with camera/video; confirm E/C stuck ellipses
  • Manual: head/webcam trackers — mouse toggle with m (OpenCV window focused)

Address several correctness and portability bugs that made tracking
unstable or prevented the project from running outside Windows.

- Cast gray-pixel sums and thresholds to int so uint8 overflow no longer
  corrupts darkest-area search and binary thresholding
- Fix contour length check operator precedence (len(arr) > 5)
- Restore stuck-ellipse overlay drawing in the stereo tracker
- Open cameras with CAP_ANY on macOS/Linux instead of CAP_MSMF-only
- Replace keyboard package hotkeys with OpenCV waitKey (Head/Webcam trackers)
- Write screen_position.txt next to the script instead of a hardcoded C: path
- Prefer local eye_test.mp4 and local output paths in pupil detectors
- Pin MediaPipe to versions that still expose solutions.face_mesh

Verified with compile checks and headless smoke tests on eye_test.mp4.
@OpenNerdz OpenNerdz changed the title Fix pupil detection overflow and cross-platform tracker issues Fix pupil overflow and cross-platform tracker bugs Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant