1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#!/usr/bin/env python
import argparse
from argaze.TobiiGlassesPro2 import TobiiEntities
def main():
"""
Explore Tobii Glasses Pro 2 interface's SD Card
"""
# manage arguments
parser = argparse.ArgumentParser(description=main.__doc__.split('-')[0])
parser.add_argument('-d', '--drive_path', metavar='DRIVE_PATH', type=str, default=None, help='drive path')
parser.add_argument('-p', '--project_path', metavar='PROJECT_PATH', type=str, default=None, help='project path')
parser.add_argument('-r', '--recording_path', metavar='RECORDING_PATH', type=str, default=None, help='recording path')
parser.add_argument('-s', '--segment_path', metavar='SEGMENT_PATH', type=str, default=None, help='segment path')
args = parser.parse_args()
if args.drive_path != None:
# Load all projects from a tobii drive
tobii_drive = TobiiEntities.TobiiDrive(args.drive_path)
for project in tobii_drive.get_all_projects():
print(f'Project id: {project.get_id()}, name: {project.get_name()}')
elif args.project_path != None:
# Load one tobii project
tobii_project = TobiiEntities.TobiiProject(args.project_path)
for participant in tobii_project.get_all_participants():
print(f'Participant id: {participant.get_id()}, name: {participant.get_name()}')
for recording in tobii_project.get_all_recordings():
print(f'Recording id: {recording.get_id()}, name: {recording.get_name()}')
elif args.recording_path != None:
# Load a tobii segment
tobii_recording = TobiiEntities.TobiiRecording(args.recording_path)
for segment in tobii_recording.get_all_segments():
print(f'Segment id: {segment.get_id()}')
elif args.segment_path != None:
# Load a tobii segment
tobii_segment = TobiiEntities.TobiiSegment(args.segment_path)
tobii_segment_video = tobii_segment.get_video()
print(f'Video width: {tobii_segment_video.get_width()}, height: {tobii_segment_video.get_height()}, fps: {tobii_segment_video.get_fps()}')
tobii_segment_data = tobii_segment.get_data()
data = tobii_segment_data.load()
for key in data.keys():
print(f'{key}: {len(data[key])} items')
print(f'{key} first item: {data[key].popitem()} items')
if __name__ == '__main__':
main()
|