public static TestResult.Error AddDataPoint( eye_tracking_mouse.ICalibrationManager calibration_manager, DataPoint data_point, eye_tracking_mouse.AdditionalDimensionsConfguration config) { var shift_position = data_point.tobii_coordinates.ToCoordinates(config); var tobii_gaze_point = new Point( data_point.tobii_coordinates.gaze_point.X, data_point.tobii_coordinates.gaze_point.Y); var shift = calibration_manager.GetShift(shift_position); var corrected_gaze_point = new Point( tobii_gaze_point.X + shift.X, tobii_gaze_point.Y + shift.Y); TestResult.Error error = new TestResult.Error { before_correction = (float)Point.Subtract( data_point.true_location_on_screen, tobii_gaze_point).Length, after_correction = (float)Point.Subtract( data_point.true_location_on_screen, corrected_gaze_point).Length, }; var correction = Point.Subtract(data_point.true_location_on_screen, tobii_gaze_point); if (error.after_correction > 5) { calibration_manager.AddShift(shift_position, new System.Drawing.Point((int)correction.X, (int)correction.Y)); } return(error); }
public static TestResult RunPerfTest( eye_tracking_mouse.ICalibrationManager calibration_manager, List <DataPoint> data_points, eye_tracking_mouse.AdditionalDimensionsConfguration config, out int avg_mcs) { int iterations_number = 4; var result = Helpers.TestCalibrationManager(calibration_manager, data_points, config); calibration_manager.Reset(); GC.Collect(); var time_before = System.Diagnostics.Process.GetCurrentProcess().TotalProcessorTime; for (int i = 0; i < iterations_number; i++) { TestCalibrationManager( calibration_manager, data_points, config); calibration_manager.Reset(); GC.Collect(); } var time_after = System.Diagnostics.Process.GetCurrentProcess().TotalProcessorTime; double total_time_ms = (time_after - time_before).TotalMilliseconds; avg_mcs = (int)(total_time_ms / iterations_number * 1000); return(result); }
public static TestResult TestCalibrationManager( eye_tracking_mouse.ICalibrationManager calibration_manager, List <DataPoint> data_points, eye_tracking_mouse.AdditionalDimensionsConfguration config) { TestResult result = new TestResult(); foreach (var data_point in data_points) { result.errors.Add(AddDataPoint(calibration_manager, data_point, config)); } return(result); }
public static TestResult[] TestCalibrationManager( eye_tracking_mouse.ICalibrationManager calibration_manager, DataSet data_set, eye_tracking_mouse.AdditionalDimensionsConfguration config) { TestResult[] result = new TestResult[data_set.sections.Length]; for (int i = 0; i < data_set.sections.Length; i++) { calibration_manager.Reset(); result[i] = new TestResult { section_name = data_set.sections[i].name }; foreach (var data_point in data_set.sections[i].data_points) { result[i].errors.Add(AddDataPoint(calibration_manager, data_point, config)); } } return(result); }