scale eye track from [0 1] to image size This function scales the eye track (from between [0+i0, 1+i1]) to the size corresponding to the display, taking care not to change the -1 values corresponding to missing data. syntax: eyeTrack = scaleEyeTrack( eyeTrack, imageSize ) inputs: eyeTrack: vector of complex (x+i*y) coordinates. -1-i1 to identify missing data. imageSize: [height; width], probably [1024; 1280]; output: eyeTrack: the appropriately scaled version
0001 % scale eye track from [0 1] to image size 0002 % 0003 % This function scales the eye track (from between [0+i0, 1+i1]) to the 0004 % size corresponding to the display, taking care not to change the -1 0005 % values corresponding to missing data. 0006 % 0007 % syntax: eyeTrack = scaleEyeTrack( eyeTrack, imageSize ) 0008 % 0009 % inputs: 0010 % eyeTrack: vector of complex (x+i*y) coordinates. -1-i1 to identify 0011 % missing data. 0012 % imageSize: [height; width], probably [1024; 1280]; 0013 % 0014 % output: 0015 % eyeTrack: the appropriately scaled version 0016 0017 function [ eyeTrack imageSize ] = scaleEyeTrack( eyeTrack, imageSize ) 0018 0019 %default scaling amount 0020 if nargin < 2 || isempty( imageSize) 0021 imageSize = [1024; 1280]; 0022 end 0023 0024 0025 xEye = real( eyeTrack ); 0026 yEye = imag(eyeTrack); 0027 existSamples = find(xEye ~= -1 ); 0028 xEye( existSamples) = xEye( existSamples).*imageSize(2); 0029 0030 0031 yEye( existSamples) = yEye( existSamples).*imageSize(1); 0032 0033 eyeTrack = xEye+1i*yEye; 0034