ScreenBasedCalibration
Provides methods and properties for managing calibrations for screen based eye trackers.
calib = ScreenBasedCalibration(tracker)
Contents
Enter Calibration Mode
Enters the Calibration Mode and the Eye Tracker is made ready for collecting data and calculating new calibrations.
calib.enter_calibration_mode()
Leave Calibration Mode
Leaves the Calibration Mode.
calib.leave_calibration_mode()
Collect Data
Adds data to the temporary calibration buffer for one calibration point. The argument used is the point the calibration user is assumed to be looking at and is given in the Active Display Area Coordinate System.
Parameters: coordinates (x,y) of the calibration point.
calib.collect_data(coordinates)
Discard Data
Removes the data associated with a specific calibration point from the temporary calibration buffer.
Parameters: coordinates (x,y) of the calibration point.
calib.discard_data(coordinates)
Compute and Apply Calibration
Uses the collected data and tries to compute calibration Parameters. If the calculation is successful, the result is applied to the eye tracker. If there is insufficient data to compute a new calibration or if the collected data is not good enough then calibration is failed and will not be applied.
Returns: an instance of the class CalibrationResult
calib.compute_and_apply()
Code Example
%% Calibration Sample Tobii = EyeTrackingOperations(); eyetracker_address = 'Address of the desired device'; % Example: % eyetracker_address = 'tet-tcp://172.28.195.1'; eyetracker = Tobii.get_eyetracker(eyetracker_address); calib = ScreenBasedCalibration(eyetracker); calib.enter_calibration_mode() points_to_collect = [[0.1,0.1];[0.1,0.9];[0.5,0.5];[0.9,0.1];[0.9,0.9]]; % When collecting data a point should be presented on the screen in the % appropriate position. for i=1:size(points_to_collect,1) collect_result = calib.collect_data(points_to_collect(i,:)); fprintf('Point [%.2f,%.2f] Collect Result: %s\n',points_to_collect(i,:),char(collect_result)); end calibration_result = calib.compute_and_apply(); fprintf('Calibration Status: %s\n',char(calibration_result.Status)); % After analisyng the calibration result one might want to re-calibrate % some of the points points_to_collect = [[0.1,0.1];[0.1,0.9];[0.5,0.5];[0.9,0.1];[0.9,0.9]]; % When collecting data a point should be presented on the screen in the % appropriate position. points_to_recalibrate = [[0.1,0.1];[0.1,0.9]]; for i=1:size(points_to_recalibrate,1) calib.discard_data(points_to_recalibrate(i,:)); collect_result = calib.collect_data(points_to_recalibrate(i,:)); fprintf('Point [%.2f,%.2f] Collect Result: %s\n',points_to_recalibrate(i,:),char(collect_result)); end calibration_result = calib.compute_and_apply(); fprintf('Calibration Status: %s\n',char(calibration_result.Status)); if calibration_result.Status == CalibrationStatus.Success points = calibration_result.CalibrationPoints; number_points = size(points,2); for i=1:number_points plot(points(i).PositionOnDisplayArea(1),points(i).PositionOnDisplayArea(2),'ok','LineWidth',10); mapping_size = size(points(i).RightEye,2); set(gca, 'YDir', 'reverse'); axis([-0.2 1.2 -0.2 1.2]) hold on; for j=1:mapping_size if points(i).LeftEye(j).Validity == CalibrationEyeValidity.ValidAndUsed plot(points(i).LeftEye(j).PositionOnDisplayArea(1), points(i).LeftEye(j).PositionOnDisplayArea(2),'-xr','LineWidth',3); end if points(i).RightEye(j).Validity == CalibrationEyeValidity.ValidAndUsed plot(points(i).RightEye(j).PositionOnDisplayArea(1),points(i).RightEye(j).PositionOnDisplayArea(2),'xb','LineWidth',3); end end end end calib.leave_calibration_mode()
See Also
Eyetracker, CalibrationEyeData, CalibrationEyeValidity, CalibrationPoint, CalibrationResult, CalibrationStatus
Version
1.1.0.23
Copyright 2017 Tobii Pro