ScreenBasedMonocularCalibration
Provides methods and properties for managing monocular and bi-monocular calibrations for screen based eye trackers. This type of calibration is not supported by all eye trackers. Check the DeviceCapabilities of the eye tracker first!
calib = ScreenBasedMonocularCalibration(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
Collects data for a calibration point for the selected eye(s). The point argument is the point on the display the 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. Parameters: eye_to_calibrate, an instance of the enum SelectedEye selected eye to calibrate
Returns: an instance of the class CalibrationStatus
calib.collect_data(coordinates,eye_to_calibrate)
Discard Data
Removes the collected data for the specified eye(s) and calibration point.
Parameters: coordinates (x,y) of the calibration point. Parameters: eye_to_calibrate, an instance of the enum SelectedEye selected eye to calibrate
calib.discard_data(coordinates,eye_to_calibrate)
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 the calibration fails and will not be applied.
Returns: an instance of the class CalibrationResult
calib.compute_and_apply()
Code Example
%% MOnocular Calibration Sample clear; Tobii = EyeTrackingOperations(); eyetracker_address = 'Address of the desired device'; % Example: % eyetracker_address = 'tet-tcp://172.28.195.1'; try eyetracker = Tobii.get_eyetracker(eyetracker_address); catch ME if (strcmp(ME.identifier,'EyeTrackerGet:error204')) fprintf('Unable to connect eye tracker.\n'); return end end calib = ScreenBasedMonocularCalibration(eyetracker); try calib.enter_calibration_mode() catch ME if (strcmp(ME.identifier,'EnterCalibrationMode:error210')) fprintf('The previous calibration was not completed!\n'); calib.leave_calibration_mode() fprintf('Calibration is restarted\n'); calib.enter_calibration_mode() else fprintf('%s\n', ME.identifier); return end end points_to_collect = [[0.1,0.1];[0.1,0.9];[0.5,0.5];[0.9,0.1];[0.9,0.9]]; % Desired eye(s) to be calibrated. eye_to_calibrate = SelectedEye.BOTH; % 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,:), eye_to_calibrate); fprintf('Point [%.2f,%.2f] Collect Result: %s\n',points_to_collect(i,:),char(collect_result.value)); end calibration_result = calib.compute_and_apply(); fprintf('Calibration Status: %d\n',calibration_result.Status.value.value); % 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,:), eye_to_calibrate); collect_result = calib.collect_data(points_to_recalibrate(i,:), eye_to_calibrate); fprintf('Point [%.2f,%.2f] Collect Result: %s\n',points_to_recalibrate(i,:),char(collect_result.value)); end calibration_result = calib.compute_and_apply(); fprintf('Calibration Status: %d\n',calibration_result.Status.value.value); 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.10.1.24
COPYRIGHT 2022 - PROPERTY OF TOBII PRO AB Copyright 2022 TOBII PRO AB - KARLSROVAGEN 2D, DANDERYD 182 53, SWEDEN - All Rights Reserved.
Copyright NOTICE: All information contained herein is, and remains, the property of Tobii Pro AB and its suppliers, if any. The intellectual and technical concepts contained herein are proprietary to Tobii Pro AB and its suppliers and may be covered by U.S.and Foreign Patents, patent applications, and are protected by trade secret or copyright law. Dissemination of this information or reproduction of this material is strictly forbidden unless prior written permission is obtained from Tobii Pro AB.