Beispiel #1
0
        private Point_Obj process_float_data(float[] input_array)
        {
            float frame_num = input_array[0];
            float success_flag = input_array[1];
            Point_Obj left_eye = new Point_Obj(input_array[2], input_array[3], input_array[4]);
            Point_Obj right_eye = new Point_Obj(input_array[5], input_array[6], input_array[7]);

            float alpha = input_array[8]*180;
            float beta = input_array[9]*180;
            float gamma = input_array[10]*180;

            if (success_flag == 0.0)
            {
                Console.WriteLine("{0}: Tracking Failure", Convert.ToInt32(frame_num));
                //Point_Obj Gaze_Pt = new Point_Obj(Single.PositiveInfinity, Single.PositiveInfinity);
                Point_Obj disp_pt_f = new Point_Obj(-1000, -1000);
                plot_gaze_point(disp_pt_f);
                disp_pt_f.set_coord(Single.PositiveInfinity, Single.PositiveInfinity, 0);
                return disp_pt_f;
            }

            Gaze_Comp G = new Gaze_Comp();
            Point_Obj p = G.get_gaze_pt(right_eye, left_eye, alpha, beta, gamma);
            Console.WriteLine("GAZE POINT (X, Y): ({0}, {1})", p.get_x(), p.get_y());
            Point_Obj disp_pt = new Point_Obj(-p.get_x(), p.get_y()+ MONITOR_DIM_Y/2);
            plot_gaze_point(disp_pt);
            Console.WriteLine("TRANSF GAZE POINT (X, Y): ({0}, {1})", disp_pt.get_x(), disp_pt.get_y());

            // Plot Rotation Angles
            plot_point("Pitch", Convert.ToDouble(alpha));
            plot_point("Yaw", Convert.ToDouble(beta));
            plot_point("Roll", Convert.ToDouble(gamma));
            set_axis();

            return p;
        }
Beispiel #2
0
        private Subj check_if_distract(Subj S, Point_Obj est_gaze_pt)
        {
            //Console.WriteLine("INPUT PT: {0}", est_gaze_pt.ToString());
            est_gaze_pt.set_coord(-est_gaze_pt.get_x(), est_gaze_pt.get_y() + MONITOR_DIM_Y / 2, est_gaze_pt.get_z());

            int cur_num_frames_distracted = S.get_num_frames_distracted();
            if (est_gaze_pt.get_x() < -MONITOR_DIM_X / 2 || est_gaze_pt.get_x() > MONITOR_DIM_X / 2)
            {
                //Console.WriteLine("INCREMENT!");
                S.set_num_frames_distracted(++cur_num_frames_distracted);
            }
            else if (est_gaze_pt.get_y() < -MONITOR_DIM_Y / 2 || est_gaze_pt.get_y() > MONITOR_DIM_Y / 2)
            {
                //Console.WriteLine("INCREMENT!!");
                S.set_num_frames_distracted(++cur_num_frames_distracted);
            }
            else
            {
                //Console.WriteLine("RESET");
                S.set_num_frames_distracted(0);
            }

            //Console.WriteLine("NUM DISTRACT FRAMES PRIOR: {0}", S.get_num_frames_distracted());

            return S;
        }