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)
# 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) if res is False: print("Calibration failed!") exit(1)
# You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/> import cv2 import numpy as np if hasattr(__builtins__, 'raw_input'): input = raw_input from tobiiglassesctrl import TobiiGlassesController ipv4_address = "192.168.71.50" tobiiglasses = TobiiGlassesController(ipv4_address, video_scene=True) project_id = tobiiglasses.create_project("Test live_scene_and_gaze.py") participant_id = tobiiglasses.create_participant(project_id, "participant_test") calibration_id = tobiiglasses.create_calibration(project_id, participant_id) 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!")