public void write_subj_to_file(Subj_Data S) { Console.WriteLine("WRITING GAZE PT DATA TO FILE"); //String out_path = Path.GetFullPath(System.Environment.GetCommandLineArgs()[1]); //String filename = out_path + "\\OUT_S" + Convert.ToString(S.get_ID()) + ".txt"; String filename = @"C:\Users\pkhorra2\Documents\AvaScholar\Attention_Detector\C#_Proj\Server_Mult_Version\MultiThreadServer_w_log\out.txt"; StreamWriter sW = new StreamWriter(filename); //ArrayList gaze_pts = S.get_gaze_pts(); List<Gaze_Data_Pt> gaze_pts = S.get_pt_list(); for (int i = 0; i < gaze_pts.Count; i++) { Point_Obj g = gaze_pts[i].gaze_pt; DateTime T = gaze_pts[i].time_stamp; sW.WriteLine("({0}, {1}) -- TIME: " + T.ToString(), g.get_x(), g.get_y()); //T.ToString()); sW.WriteLine("TICKS: {0}", T.Ticks); } sW.Flush(); sW.Close(); Console.WriteLine("DONE WRITING"); }
private Point_Obj process_float_data(float[] input_array, Subj_Data S) { float frame_num = input_array[0]; float success_flag = input_array[1]; if (success_flag == 1.0) { Console.WriteLine("{0}: Gaze Pt Package", Convert.ToInt32(frame_num)); 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; int ID = S.get_ID(); Gaze_Comp G = new Gaze_Comp(); Point_Obj p = G.get_gaze_pt(right_eye, left_eye, alpha, beta, gamma); Console.WriteLine("{0} - GAZE POINT (X, Y): ({1}, {2})", ID, p.get_x(), p.get_y()); Point_Obj disp_pt = new Point_Obj(-p.get_x(), p.get_y() + S.get_MONITOR_DIM_Y() / 2); plot_gaze_point(disp_pt, S); Console.WriteLine("{0} - TRANSF GAZE POINT (X, Y): ({1}, {2})", ID, disp_pt.get_x(), disp_pt.get_y()); return p; } else if(success_flag == 2.0) { float age = input_array[2]; float gender = input_array[3]; Console.WriteLine("{0}: Age/Gender Package", Convert.ToInt32(frame_num)); S.set_age(Convert.ToDouble(age)); if (gender >= 0.5) { // Male S.set_gender('M'); } else { // Female S.set_gender('F'); } disp_age(S); disp_gender(S); if (S.get_pt_list().Count != 0) { return S.get_pt_list().Last().gaze_pt; } else { return new Point_Obj(0.0F, -S.get_MONITOR_DIM_Y()/2); } } else { 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(-1000F, -1000F); plot_gaze_point(disp_pt_f, S); //disp_pt_f.set_coord(Single.PositiveInfinity, Single.PositiveInfinity, 0); return disp_pt_f; } }