def main():

    tobiiglasses = TobiiGlassesController()
    print tobiiglasses.get_battery_info()
    print tobiiglasses.get_storage_info()

    if tobiiglasses.is_recording():
        rec_id = tobiiglasses.get_current_recording_id()
        tobiiglasses.stop_recording(rec_id)

    project_name = raw_input("Please insert the project's name: ")
    project_id = tobiiglasses.create_project(project_name)

    participant_name = raw_input("Please insert the participant's name: ")
    participant_id = tobiiglasses.create_participant(project_id,
                                                     participant_name)

    calibration_id = tobiiglasses.create_calibration(project_id,
                                                     participant_id)
    raw_input(
        "Put the calibration marker in front of the user, then press enter to calibrate"
    )
    tobiiglasses.start_calibration(calibration_id)

    res = tobiiglasses.wait_until_calibration_is_done(calibration_id)

    if res is False:
        print("Calibration failed!")
        exit(1)

    recording_id = tobiiglasses.create_recording(participant_id)
    print "Important! The recording will be stored in the SD folder projects/%s/recordings/%s" % (
        project_id, recording_id)
    raw_input("Press enter to start recording")
    tobiiglasses.start_recording(recording_id)
    tobiiglasses.send_event("start_recording", "Start of the recording ")
    raw_input("Press enter to stop recording")
    tobiiglasses.send_event("stop_recording",
                            "Stop of the recording " + str(recording_id))
    tobiiglasses.stop_recording(recording_id)

    if res is False:
        print("Recording failed!")
        exit(1)
示例#2
0
import json

address = "192.168.71.50"
tobiiglasses = TobiiGlassesController(address)

# getting livestream video with opencv
address_rtsp = "rtsp://" + address + ":8554/live/scene"
vcap = cv.VideoCapture(address_rtsp)

#save video output
out = cv.VideoWriter('output.avi', cv.cv.CV_FOURCC(*'MJPG'), 20.0,
                     (int(vcap.get(3)), int(vcap.get(4))))

# calibration
if tobiiglasses.is_recording():
    rec_id = tobiiglasses.get_current_recording_id()
    tobiiglasses.stop_recording(rec_id)

project_name = raw_input("Please insert the project's name: ")
project_id = tobiiglasses.create_project(project_name)

participant_name = raw_input("Please insert the participant's name: ")
participant_id = tobiiglasses.create_participant(project_id, participant_name)

calibration_id = tobiiglasses.create_calibration(project_id, participant_id)
raw_input(
    "Put the calibration marker in front of the user, then press enter to calibrate"
)
tobiiglasses.start_calibration(calibration_id)

res = tobiiglasses.wait_until_calibration_is_done(calibration_id)