Home > data-import > shift_eye_variable_times.m

shift_eye_variable_times

PURPOSE ^

% This script will modify the timing information for all the eye

SYNOPSIS ^

function shift_eye_variable_times(sid, agent, num_frames)

DESCRIPTION ^

% This script will modify the timing information for all the eye  
 variables for either the child or parent. This should be used after syncing  
 the cameras by adding or subtracting a set number of frames from a camera's
 frame sequence.

 sid:
   The subject id number for matlab.

 agent: 
   'parent' or 'child' 

 num_frames:
   The number of frames that were shifted in the extracted frames to sync
   camera's 5 and 6.  This can be a positive or negative number.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function shift_eye_variable_times(sid, agent, num_frames)
0002 %% This script will modify the timing information for all the eye
0003 % variables for either the child or parent. This should be used after syncing
0004 % the cameras by adding or subtracting a set number of frames from a camera's
0005 % frame sequence.
0006 %
0007 % sid:
0008 %   The subject id number for matlab.
0009 %
0010 % agent:
0011 %   'parent' or 'child'
0012 %
0013 % num_frames:
0014 %   The number of frames that were shifted in the extracted frames to sync
0015 %   camera's 5 and 6.  This can be a positive or negative number.
0016 %
0017 %
0018 
0019 % Convert the frame difference between the camera's to a time difference in
0020 % seconds to change the variables by.
0021 time_diff = num_frames / 29.97;
0022 
0023 
0024 roi_list ={'obj1','obj2','obj3','head'};
0025    
0026 % Change VideoCoder Variables
0027 for j = 1 : size(roi_list,2)
0028     
0029     % Cstreams
0030     temp_cstream_name = sprintf('cstream_eye_roi_%s_%s', roi_list{j}, agent)
0031     temp_cstream = get_variable(sid, temp_cstream_name);
0032     new_cstream = cstream_time_shift(temp_cstream, time_diff);
0033     record_variable(sid, temp_cstream_name, new_cstream)
0034 
0035     % Events
0036     temp_event_name = sprintf('event_eye_roi_%s_%s', roi_list{j}, agent)
0037     temp_event = get_variable(sid, temp_event_name);
0038     new_event = cevent_time_shift(temp_event, time_diff);
0039     record_variable(sid, temp_event_name, new_event)
0040     
0041 end;
0042 
0043 % Change combined cstreams and cevents from make_inhand.m
0044 % Extra Cstream
0045 temp_cstream_name = sprintf('cstream_eye_roi_%s', agent)
0046 temp_cstream = get_variable(sid, temp_cstream_name);
0047 new_cstream = cstream_time_shift(temp_cstream, time_diff);
0048 record_variable(sid, temp_cstream_name, new_cstream)
0049     
0050 % Cont's
0051 temp_cont_x_name = sprintf('cont_eye_x_%s', agent)
0052 temp_cont_y_name = sprintf('cont_eye_y_%s', agent)
0053 
0054 temp_cont_x = get_variable(sid, temp_cont_x_name);
0055 temp_cont_y = get_variable(sid, temp_cont_y_name);
0056 
0057 new_cont_x = cont_time_shift(temp_cont_x, time_diff);
0058 new_cont_y = cont_time_shift(temp_cont_y, time_diff);
0059 
0060 record_variable(sid, temp_cont_x_name, new_cont_x)
0061 record_variable(sid, temp_cont_y_name, new_cont_y)
0062 
0063 % Cont2's
0064 temp_cont2_name = sprintf('cont2_eye_xy_%s', agent)
0065 temp_cont2 = get_variable(sid, temp_cont2_name);
0066 
0067 new_times = temp_cont2(:,1) + time_diff;
0068 new_cont2 = [new_times temp_cont2(:,2:3)];
0069 record_variable(sid, temp_cont2_name, new_cont2)
0070 
0071 % Cevents
0072 temp_cevent_name = sprintf('cevent_eye_roi_%s', agent)
0073 temp_cevent = get_variable(sid, temp_cevent_name);
0074 new_cevent = cevent_time_shift(temp_cevent, time_diff);
0075 record_variable(sid, temp_cevent_name, new_cevent)
0076 
0077 
0078 
0079 
0080 
0081

Generated on Tue 23-May-2017 02:00:59 by m2html © 2005