Home > data-import > shift_inhand_variable_times.m

shift_inhand_variable_times

PURPOSE ^

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

SYNOPSIS ^

function shift_inhand_variable_times(sid, agent, num_frames)

DESCRIPTION ^

% This script will modify the timing information for all the inhand  
 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_inhand_variable_times(sid, agent, num_frames)
0002 %% This script will modify the timing information for all the inhand
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 % Variable name parts
0024 inhand_list ={'obj1','obj2','obj3'};
0025 hand_type = {'left','right'};
0026 
0027 % Loop through variables and update each.
0028 for j = 1 : size(inhand_list,2)  % 1-3
0029     
0030 %     % Change VideoCoder Variables
0031 %     for m = 1 : size(hand_type,2) % 1-3
0032 %
0033 %         % Cstreams
0034 %         temp_cstream_name = sprintf('cstream_%s_inhand_%s_%s',inhand_list{j}, agent, hand_type{m});
0035 %         temp_cstream = get_variable(sid, temp_cstream_name);
0036 %         new_cstream = cstream_time_shift(temp_cstream, time_diff);
0037 %         record_variable(sid, temp_cstream_name, new_cstream)
0038 %
0039 %         % Events
0040 %         temp_event_name = sprintf('event_%s_inhand_%s_%s',inhand_list{j}, agent, hand_type{m});
0041 %         temp_event = get_variable(sid, temp_event_name);
0042 %         new_event = cevent_time_shift(temp_event, time_diff);
0043 %         record_variable(sid, temp_event_name, new_event)
0044 %
0045 %     end;
0046     
0047     % Change combined cstreams and cevents from make_inhand.m
0048     % Cstreams
0049     temp_cstream_name = sprintf('cstream_inhand_%s_%s',inhand_list{j}, agent);
0050     temp_cstream = get_variable(sid, temp_cstream_name);
0051     new_cstream = cstream_time_shift(temp_cstream, time_diff);
0052     record_variable(sid, temp_cstream_name, new_cstream)
0053 
0054     % Events
0055     temp_event_name = sprintf('event_inhand_%s_%s',inhand_list{j}, agent);
0056     temp_event = get_variable(sid, temp_event_name);
0057     new_event = cevent_time_shift(temp_event, time_diff);
0058     record_variable(sid, temp_event_name, new_event)
0059     
0060 end;
0061 
0062 % Cevents
0063 temp_cevent_name = sprintf('cevent_inhand_%s', agent);
0064 temp_cevent = get_variable(sid, temp_cevent_name);
0065 new_cevent = cevent_time_shift(temp_cevent, time_diff);
0066 record_variable(sid, temp_cevent_name, new_cevent)
0067 
0068 
0069 
0070

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