Currently I am working on a project using Kinect which requires me to know the where the person is looking at that time, for which I figured out I need to find the line of sight of that person.
Right now, I can find the head point of the skeleton of the person but can't track the eye movement.
if (body.TrackingState == SkeletonTrackingState.Tracked)
{
Joint joint = body.Joints[JointType.Head];
SkeletonPoint skeletonPoint = joint.Position;
// 2D coordinates in pixels
System.Drawing.Point point = new System.Drawing.Point();
if (_mode == CameraMode.Color)
{
// Skeleton-to-Color mapping
ColorImagePoint colorPoint = _sensor.CoordinateMapper.MapSkeletonPointToColorPoint(skeletonPoint, ColorImageFormat.RgbResolution640x480Fps30);
point.X = colorPoint.X;
point.Y = colorPoint.Y;
//Console.WriteLine(" X == " + point.X + " Y == " + point.Y);
X = (int)Math.Floor(point.X + 0.5);
Y = (int)Math.Floor(point.Y + 0.5);
}
// DRAWING...
Ellipse ellipse = new Ellipse
{
Fill = System.Windows.Media.Brushes.LightBlue,
Width = 20,
Height = 20
};
Canvas.SetLeft(ellipse, point.X - ellipse.Width / 2);
Canvas.SetTop(ellipse, point.Y - ellipse.Height / 2);
canvas.Children.Add(ellipse);
}
Here point.X and point.Y are the head points of the skeleton.