Skip to content

Commit

Permalink
Gaze topics: Switch format from 0/1/2 to 0./1./01.
Browse files Browse the repository at this point in the history
  • Loading branch information
papr committed Feb 27, 2018
1 parent a306c8b commit 9916335
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pupil_src/shared_modules/calibration_routines/gaze_mappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def __init__(self, g_pool):
super().__init__(g_pool)

def _map_monocular(self, p):
return {'topic': 'gaze.2d.{}'.format(p['id']),
return {'topic': 'gaze.2d.{}.'.format(p['id']),
'norm_pos': p['norm_pos'],
'confidence': p['confidence'],
'timestamp': p['timestamp'],
Expand All @@ -158,7 +158,7 @@ def __init__(self, g_pool, params):

def _map_monocular(self, p):
gaze_point = self.map_fn(p['norm_pos'])
return {'topic': 'gaze.2d.{}'.format(p['id']),
return {'topic': 'gaze.2d.{}.'.format(p['id']),
'norm_pos': gaze_point,
'confidence': p['confidence'],
'id': p['id'],
Expand All @@ -180,7 +180,7 @@ def __init__(self, g_pool, params0, params1):

def _map_monocular(self, p):
gaze_point = self.map_fns[p['id']](p['norm_pos'])
return {'topic': 'gaze.2d.{}'.format(p['id']),
return {'topic': 'gaze.2d.{}.'.format(p['id']),
'norm_pos': gaze_point,
'confidence': p['confidence'],
'id': p['id'],
Expand Down Expand Up @@ -221,15 +221,15 @@ def _map_binocular(self, p0, p1):
(gaze_point_eye0[1] + gaze_point_eye1[1])/2.)
confidence = (p0['confidence'] + p1['confidence'])/2.
ts = (p0['timestamp'] + p1['timestamp'])/2.
return {'topic': 'gaze.2d.2',
return {'topic': 'gaze.2d.01.',
'norm_pos': gaze_point,
'confidence': confidence,
'timestamp': ts,
'base_data': [p0, p1]}

def _map_monocular(self, p):
gaze_point = self.map_fn_fallback[p['id']](p['norm_pos'])
return {'topic': 'gaze.2d.2',
return {'topic': 'gaze.2d.{}.'.format(p['id']),
'norm_pos': gaze_point,
'confidence': p['confidence'],
'timestamp': p['timestamp'],
Expand Down Expand Up @@ -294,7 +294,7 @@ def _map_monocular(self,p):
gaze_3d = self.toWorld(gaze_point)
normal_3d = np.dot( self.rotation_matrix, np.array( p['circle_3d']['normal'] ) )

g = { 'topic': 'gaze.2d.2',
g = { 'topic': 'gaze.3d.{}.'.format(p['id']),
'norm_pos': image_point,
'eye_center_3d': eye_center.tolist(),
'gaze_normal_3d': normal_3d.tolist(),
Expand Down Expand Up @@ -407,7 +407,7 @@ def _map_monocular(self, p):

normal_3d = self.rotation_matricies[p_id] @ np.array(p['circle_3d']['normal'])

g = {'topic': 'gaze.3d.2',
g = {'topic': 'gaze.3d.{}.'.format(p_id),
'eye_centers_3d': {p['id']: eye_center.tolist()},
'gaze_normals_3d': {p['id']: normal_3d.tolist()},
'gaze_point_3d': gaze_3d.tolist(),
Expand Down Expand Up @@ -490,7 +490,7 @@ def _map_binocular(self, p0, p1):

confidence = min(p0['confidence'],p1['confidence'])
ts = (p0['timestamp'] + p1['timestamp'])/2.
g = {'topic': 'gaze.3d.2',
g = {'topic': 'gaze.3d.01.',
'eye_centers_3d': {0: s0_center.tolist(), 1: s1_center.tolist()},
'gaze_normals_3d': {0: s0_normal.tolist(), 1: s1_normal.tolist()},
'gaze_point_3d': nearest_intersection_point.tolist(),
Expand Down

0 comments on commit 9916335

Please sign in to comment.