예제 #1
0
 public Eye(Eye other)
 {
     if (null != other)
     {
         RawCoordinates = new Point2D(other.RawCoordinates);
         SmoothedCoordinates = new Point2D(other.SmoothedCoordinates);
         PupilCenterCoordinates = new Point2D(other.PupilCenterCoordinates);
         PupilSize = other.PupilSize;
     }
 }
예제 #2
0
        public GazeData()
        {
            DateTime now = DateTime.Now;
            TimeStamp = (long)((double)now.Ticks / TimeSpan.TicksPerMillisecond);
            TimeStampString = now.ToString(TIMESTAMP_STRING_FORMAT);
            IsFixated = false;
            RawCoordinates = Point2D.Zero;
            SmoothedCoordinates = Point2D.Zero;

            LeftEye = new Eye();
            RightEye = new Eye();
        }
예제 #3
0
        public GazeData(GazeData other)
        {
            if (null != other)
            {
                State           = other.State;
                TimeStamp       = other.TimeStamp;
                TimeStampString = other.TimeStampString;

                RawCoordinates      = new Point2D(other.RawCoordinates);
                SmoothedCoordinates = new Point2D(other.SmoothedCoordinates);

                LeftEye  = new Eye(other.LeftEye);
                RightEye = new Eye(other.RightEye);

                IsFixated = other.IsFixated;
            }
        }
예제 #4
0
        public GazeData(GazeData other)
        {
            if (null != other)
            {
                State = other.State;
                TimeStamp = other.TimeStamp;
                TimeStampString = other.TimeStampString;

                RawCoordinates = new Point2D(other.RawCoordinates);
                SmoothedCoordinates = new Point2D(other.SmoothedCoordinates);

                LeftEye = new Eye(other.LeftEye);
                RightEye = new Eye(other.RightEye);

                IsFixated = other.IsFixated;
            }
        }
예제 #5
0
        private void Set(GazeData other)
        {
            State = other.State;
            TimeStamp = other.TimeStamp;
            TimeStampString = other.TimeStampString;

            RawCoordinates = new Point2D(other.RawCoordinates);
            SmoothedCoordinates = new Point2D(other.SmoothedCoordinates);

            LeftEye = new Eye(other.LeftEye);
            RightEye = new Eye(other.RightEye);

            IsFixated = other.IsFixated;
        }
예제 #6
0
        /// <summary>
        /// Calculates distance between pupil centers based on previously
        /// recorded min and max values
        /// </summary>
        /// <param name="leftEye"></param>
        /// <param name="rightEye"></param>
        /// <returns>a normalized value [0f..1f]</returns>
        public static double GetEyesDistanceNormalized(Eye leftEye, Eye rightEye)
        {
            double dist = Math.Abs(GetDistancePoint2D(leftEye.PupilCenterCoordinates, rightEye.PupilCenterCoordinates));

            if (dist < _MinimumEyesDistance)
                _MinimumEyesDistance = dist;

            if (dist > _MaximumEyesDistance)
                _MaximumEyesDistance = dist;

            //return normalized
            return dist / (_MaximumEyesDistance - _MinimumEyesDistance);
        }
예제 #7
0
        /// <summary>
        /// Find average pupil center of two eyes.
        /// </summary>
        /// <param name="leftEye"></param>
        /// <param name="rightEye"></param>
        /// <param name="screenWidth"></param>
        /// <param name="screenHeight"></param>
        /// <returns>the average center point in pixels</returns>
        public static Point2D GetEyesCenterPixels(Eye leftEye, Eye rightEye, int screenWidth, int screenHeight)
        {
            Point2D center = GetEyesCenterNormalized(leftEye, rightEye);

            return GetRelativeToScreenSpace(center, screenWidth, screenHeight);
        }
예제 #8
0
        /// <summary>
        /// Find average pupil center of two eyes.
        /// </summary>
        /// <param name="leftEye"></param>
        /// <param name="rightEye"></param>
        /// <returns>the average center point in normalized values</returns>
        public static Point2D GetEyesCenterNormalized(Eye leftEye, Eye rightEye)
        {
            Point2D eyeCenter = Point2D.Zero;

            if (null != leftEye && null != rightEye)
            {
                eyeCenter = new Point2D(
                        (leftEye.PupilCenterCoordinates.X + rightEye.PupilCenterCoordinates.X) / 2,
                        (leftEye.PupilCenterCoordinates.Y + rightEye.PupilCenterCoordinates.Y) / 2
                        );
            }
            else if (null != leftEye)
            {
                eyeCenter = leftEye.PupilCenterCoordinates;
            }
            else if (null != rightEye)
            {
                eyeCenter = rightEye.PupilCenterCoordinates;
            }

            return eyeCenter;
        }