Home > GVSToolbox > scaleEyeTrack.m

scaleEyeTrack

PURPOSE ^

scale eye track from [0 1] to image size

SYNOPSIS ^

function [ eyeTrack imageSize ] = scaleEyeTrack( eyeTrack, imageSize )

DESCRIPTION ^

  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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

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) = abs( yEye( existSamples)-1);  %flip vertically
0032 yEye( existSamples) = yEye( existSamples).*imageSize(1);
0033 
0034 
0035 
0036 
0037 eyeTrack = xEye+1i*yEye;
0038

Generated on Tue 01-Jul-2014 12:35:04 by m2html © 2005