Beispiel #1
0
        private Vector3 ExtractGazeNormal(Dictionary <string, object> dictionary, GazeMappingContext context, byte eye)
        {
            object vecObj;

            if (context == GazeMappingContext.Binocular)
            {
                var binoDic = dictionary["gaze_normals_3d"] as Dictionary <object, object>;
                // Starting with Pupil 3.0, all keys are strings
                vecObj = binoDic.ContainsKey(eye) ? binoDic[eye] : binoDic[eye.ToString()];
            }
            else
            {
                vecObj = dictionary["gaze_normal_3d"];
            }
            Vector3 gazeNormal = Helpers.Position(vecObj, false);

            gazeNormal.y *= -1f;
            return(gazeNormal);
        }
Beispiel #2
0
        private Vector3 ExtractEyeCenter(Dictionary <string, object> dictionary, GazeMappingContext context, byte eye)
        {
            object vecObj;

            if (context == GazeMappingContext.Binocular)
            {
                var binoDic = dictionary["eye_centers_3d"] as Dictionary <object, object>;
                // Starting with Pupil 3.0, all keys are strings
                vecObj = binoDic.ContainsKey(eye) ? binoDic[eye] : binoDic[eye.ToString()];
            }
            else
            {
                vecObj = dictionary["eye_center_3d"];
            }
            Vector3 eyeCenter = Helpers.Position(vecObj, true);

            eyeCenter.y *= -1;
            return(eyeCenter);
        }