Beispiel #1
0
 public Eye(Eye other)
 {
     if (null != other)
     {
         RawCoordinates = other.RawCoordinates.Clone();
         SmoothedCoordinates = other.SmoothedCoordinates.Clone();
         PupilCenterCoordinates = other.PupilCenterCoordinates.Clone();
         PupilSize = other.PupilSize;
     }
 }
Beispiel #2
0
        public GazeData()
        {
            TimeStamp = (long)Math.Round(DateTime.Now.TimeOfDay.TotalMilliseconds);
            IsFixated = false;
            RawCoordinates = new Point2D();
            SmoothedCoordinates = new Point2D();

            LeftEye = new Eye();
            RightEye = new Eye();
        }
Beispiel #3
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;
     }
 }
        public GazeData()
        {
            DateTime now = DateTime.Now;
            TimeStamp = (long)((double)now.Ticks / TimeSpan.TicksPerMillisecond);
            TimeStampString = now.ToString(TIMESTAMP_STRING_FORMAT);
            IsFixated = false;
            RawCoordinates = new Point2D();
            SmoothedCoordinates = new Point2D();

            LeftEye = new Eye();
            RightEye = new Eye();
        }
        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;
            }
        }
Beispiel #6
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;
            }
        }
        /// <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 = new Point2D();

            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;
        }
        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;
        }
        /// <summary>
        /// Find average pupil center of two eyes.
        /// </summary>
        /// <param name="leftEye"/></param>
        /// <param name="rightEye"/></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);
        }
Beispiel #10
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 [0..1]</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);
        }