Welcome! Log In Create A New Profile

Advanced

extracting & applying 2D eye transform

Posted by gianni 
extracting & applying 2D eye transform
November 04, 2021 02:02PM
Hi there,

we used the 2D spatial transformation to calibrate an eye-signal, & would now like to extract that transformation matrix in order to apply it (specifically, apply it to a copy of the raw, uncalibrated eye-data, which was collected on a different clock than ML). However, I cant seem to find it in the MLConfig file (attaching one of mine here). I see MLConfig.EyeTransform, but for me that only contains fields of "offset" which seem to be empty. MLConfig.EyeTransform{1,3} has much more info -- I am wondering if MLConfig.EyeTransform{1,3}.tdata.T (or Tinv) is the transformation matrix I am looking for?

thank much,
G
Attachments:
open | download - MLConfig.zip (4.6 KB)
Re: extracting & applying 2D eye transform
November 05, 2021 01:38PM
That is the transformation matrix, but just knowing where it is will not help you much. Keep reading if you want to know how to use the matrix.

First of all, you need to fill out some missing information in MLConfig, since MLConfig does not keep the information of the subject screen dimension.
sx = 1024;  % subject screen width
sy = 768;   % subject screen height
MLConfig.Screen.SubjectScreenRect = [0 0 sx sy];
MLConfig.Screen.SubjectScreenFullSize = [sx sy];
MLConfig.Screen.SubjectScreenHalfSize = 0.5 * [sx sy];
MLConfig.Screen.SubjectScreenAspectRatio = sx / sy;

Then reconstruct the calibration object.
EyeCal = mlcalibrate('eye', MLConfig, 1);  % 1 means Eye #1

With the calibration object, you can calculate the degree positions of raw signals like the following.
deg_xy = EyeCal.sig2deg(raw_xy, [0 0]);  % raw_xy is an n-by-2 matrix. [0 0] is offset; do not change it.

-----

FYI, MLConfig at the time of recording is saved in the data file and you can retrieve it like this.
[data, MLConfig] = mlread;
In the new version of NIMH ML, MLConfig will keep the subject screen info so that there is no need to fill it out later.

The National Institute of Mental Health (NIMH) is part of the National Institutes of Health (NIH), a component of the U.S. Department of Health and Human Services.