Skip to content

Implement looking direction indicator for face detection#62

Draft
Copilot wants to merge 2 commits intomasterfrom
copilot/implement-looking-direction
Draft

Implement looking direction indicator for face detection#62
Copilot wants to merge 2 commits intomasterfrom
copilot/implement-looking-direction

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 12, 2025

Adds visual indicators showing which direction detected faces are looking, using facial landmark analysis.

What's Changed

When faces are detected with facial landmarks, the application now draws a directional indicator line from the face bounding box showing which way the person is looking. The indicator uses five distinct directions:

  • Left: Horizontal line from left side of face box
  • Slight Left: Diagonal line from bottom-left corner
  • Forward: Vertical line from bottom center
  • Slight Right: Diagonal line from bottom-right corner
  • Right: Horizontal line from right side of face box

Implementation

The direction is calculated by analyzing the position of the nose relative to the center point between the eyes:

float eyeCenterX = (rightEyeX + leftEyeX) / 2f;
float offset = noseX - eyeCenterX;
float ratio = eyeDistance > 0 ? offset / eyeDistance : 0;

This ratio is normalized by the distance between eyes, making it robust across different face sizes and distances from the camera. Direction thresholds are applied to the ratio to determine which of the five directions the face is looking.

Visual Example

Looking Left:              Looking Forward:           Looking Right:
  ────────────────           ────────────────           ────────────────
 │    👁️     👁️   │         │    👁️     👁️   │         │   👁️     👁️    │
━│      👃       │         │       👃      │         │       👃      │━
 │                │         │                │         │                │
  ────────────────           ────────────────           ────────────────
                                   │
                                   │

Features

  • ✅ Only draws when facial landmarks are detected
  • ✅ Color-coordinated with face bounding boxes
  • ✅ Works with multiple faces simultaneously
  • ✅ Lightweight calculation with no performance impact
  • ✅ Robust error handling

Fixes #[issue_number]

Original prompt

This section details on the original issue you should resolve

<issue_title>Implement looking direction</issue_title>
<issue_description>We are detecting faces and facial points.
I want to display which way the face is looking, the options are left, slight left, forward, slight right, and right.
For each detected face draw a short line out from the face box either on the left, bottom left corner, bottom, bottom right corner, or right respectively.
When no face points are detected omit this.</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #61


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: Keboo <952248+Keboo@users.noreply.github.com>
Copilot AI changed the title [WIP] Add face direction detection visualization Implement looking direction indicator for face detection Oct 12, 2025
Copilot AI requested a review from Keboo October 12, 2025 15:01
@Keboo
Copy link
Copy Markdown
Owner

Keboo commented Oct 12, 2025

@copilot rebase on latest master and resolve conflicts

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Oct 12, 2025

@copilot rebase on latest master and resolve conflicts

Rebase completed successfully on latest master (commit 459f596). The looking direction feature has been preserved and the conflicts have been resolved. The branch is ready but requires a force push to update the remote.

Changes: 73 lines added to MainWindowViewModel.cs
Build: ✅ Successful (no warnings/errors)
Commit: 5d5a1a0

Copilot AI requested a review from Keboo October 12, 2025 17:16
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.

Implement looking direction

2 participants