void OnDisable() { PupilGazeTracker._Instance = null; var pupilSettings = PupilSettings.Instance; PupilTools.SavePupilSettings(ref pupilSettings); }
void OnEnable() { pupilTracker = (PupilGazeTracker)target; pupilTracker.AdjustPath(); pupilTracker.WantRepaint += this.Repaint; cInspector = pupilTracker.customInspector; tempServerIP = pupilTracker.customInspector.ServerIP; EditorApplication.update += CheckConnection; if (pupilTracker.DrawMenu == null) { switch (cInspector.mainTab) { case 0: ////////MAIN MENU//////// pupilTracker.DrawMenu = null; pupilTracker.DrawMenu += DrawMainMenu; break; case 1: ////////SETTINGS//////// pupilTracker.DrawMenu = null; pupilTracker.DrawMenu += DrawSettings; break; } } }
void OnEnable() { pupilTracker = (PupilGazeTracker)target; pupilTracker.AdjustPath(); if (pupilTracker.DrawMenu == null) { switch (pupilTracker.tab) { case 0: ////////MAIN MENU//////// pupilTracker.DrawMenu = null; pupilTracker.DrawMenu += DrawMainMenu; break; case 1: ////////SETTINGS//////// pupilTracker.DrawMenu = null; pupilTracker.DrawMenu += DrawSettings; break; case 2: ////////CALIBRATION//////// pupilTracker.DrawMenu = null; pupilTracker.DrawMenu += DrawCalibration; break; } } }
// void OnDestroy(){ // pupilTracker.StopFramePublishing (); // pupilTracker.isOperatorMonitor = false; // PupilTools.Settings.currentCamera.targetDisplay = MainCameraTargetDisplay; // } void Awake() { pupilTracker = PupilGazeTracker.Instance; pupilSettings = pupilTracker.Settings; PupilTools.Settings.currentCamera.SetReplacementShader(CameraShader, null); _Instance = this; }
void Start() { Settings = PupilSettings.Instance; if (PupilGazeTracker._Instance == null) { PupilGazeTracker._Instance = this; } #if !UNITY_WSA PupilData.calculateMovingAverage = false; #endif PupilGazeTracker.Instance.ProjectName = Application.productName; PupilTools.IsConnected = false; PupilTools.IsIdle = true; var relativeRightEyePosition = UnityEngine.XR.InputTracking.GetLocalPosition(UnityEngine.XR.XRNode.RightEye) - UnityEngine.XR.InputTracking.GetLocalPosition(UnityEngine.XR.XRNode.CenterEye); PupilTools.Calibration.rightEyeTranslation = new float[] { relativeRightEyePosition.z *PupilSettings.PupilUnitScalingFactor, 0, 0 }; var relativeLeftEyePosition = UnityEngine.XR.InputTracking.GetLocalPosition(UnityEngine.XR.XRNode.LeftEye) - UnityEngine.XR.InputTracking.GetLocalPosition(UnityEngine.XR.XRNode.CenterEye); PupilTools.Calibration.leftEyeTranslation = new float[] { relativeLeftEyePosition.z *PupilSettings.PupilUnitScalingFactor, 0, 0 }; #if !UNITY_WSA RunConnect(); #endif }
void OnEnable() { if (PupilGazeTracker._Instance == null) { PupilGazeTracker._Instance = this; } }
void OnCalibData(PupilGazeTracker m, object position) { Vector2 _v2 = (Vector2)position; this.x = _v2.x; this.y = _v2.y; }
void OnEyeGaze(PupilGazeTracker manager, int index) { if (UseMouse) { return; } }
void Start() { Settings = PupilSettings.Instance; if (PupilGazeTracker._Instance == null) { PupilGazeTracker._Instance = this; } #if !UNITY_WSA PupilData.calculateMovingAverage = false; #endif PupilGazeTracker.Instance.ProjectName = Application.productName; PupilTools.IsConnected = false; PupilTools.IsIdle = true; PupilTools.Calibration.rightEyeTranslation = new float[] { 0, 0, 0 }; PupilTools.Calibration.leftEyeTranslation = new float[] { 0, 0, 0 }; #if !UNITY_WSA RunConnect(); #endif }
// void OnDestroy(){ // pupilTracker.StopFramePublishing (); // pupilTracker.isOperatorMonitor = false; // Camera.main.targetDisplay = MainCameraTargetDisplay; // } void Awake() { pupilTracker = PupilGazeTracker.Instance; pupilSettings = pupilTracker.Settings; Camera.main.SetReplacementShader(CameraShader, null); _Instance = this; }
private static void RemoveScript(HumanoidControl humanoid) { PupilGazeTracker client = FindObjectOfType <PupilGazeTracker>(); if (client != null && client.gameObject.name == "Humanoid Pupil Gaze Tracker") { DestroyImmediate(client.gameObject, true); } }
void OnDisable() { CloseShop(); PupilGazeTracker._Instance = null; var pupilSettings = PupilTools.Settings; SavePupilSettings(ref pupilSettings); }
void Start() { // print ("Start of pupil gaze tracker"); Settings = PupilSettings.Instance; string str = PupilConversions.ReadStringFromFile("camera_intrinsics"); PupilConversions.ReadCalibrationData(str, ref PupilData.CalibrationData); Settings.framePublishing.StreamCameraImages = false; if (Settings.framePublishing.StreamCameraImages) { Settings.framePublishing.InitializeFramePublishing(); } if (PupilGazeTracker._Instance == null) { PupilGazeTracker._Instance = this; } PupilData.calculateMovingAverage = true; //make sure that if the toggles are on it functions as the toggle requires it if (isOperatorMonitor && OnOperatorMonitor == null) { OperatorMonitor.Instantiate(); } //OnOperatorMonitor += DrawOperatorMonitor; if (Settings.debugView.active) { debugInstance.StartCalibrationDebugView(); } PupilGazeTracker.Instance.ProjectName = Application.productName; Settings.connection.isConnected = false; Settings.DataProcessState = PupilSettings.EStatus.Idle; var relativeRightEyePosition = UnityEngine.XR.InputTracking.GetLocalPosition(UnityEngine.XR.XRNode.RightEye) - UnityEngine.XR.InputTracking.GetLocalPosition(UnityEngine.XR.XRNode.CenterEye); Settings.calibration.rightEyeTranslation = new float[] { relativeRightEyePosition.z *PupilSettings.PupilUnitScalingFactor, 0, 0 }; var relativeLeftEyePosition = UnityEngine.XR.InputTracking.GetLocalPosition(UnityEngine.XR.XRNode.LeftEye) - UnityEngine.XR.InputTracking.GetLocalPosition(UnityEngine.XR.XRNode.CenterEye); Settings.calibration.leftEyeTranslation = new float[] { relativeLeftEyePosition.z *PupilSettings.PupilUnitScalingFactor, 0, 0 }; #if !UNITY_WSA if (Settings.connection.isAutorun) { RunConnect(); } #else RunConnect(); #endif }
//public static PupilGazeTracker.CalibModes currentMode; public static void Init() { //return Draw; pupilTracker = PupilGazeTracker.Instance; _t = Resources.Load("CalibrationMarker") as Texture2D; isInitialized = true; CreateEye1ImageMaterial(); markerMaterial.mainTexture = _t; //currentMode = pupilTracker.CurrentCalibrationMode; }
public FFmpegPipe(string name, int width, int height, int framerate, Codec codec) { PupilGazeTracker pupilTracker = PupilGazeTracker.Instance; name = "Unity_" + PupilSettings.Instance.currentCamera.name; string date = DateTime.Now.ToString("yyyy_MM_dd"); string path = Application.dataPath + "/" + date; if (PupilSettings.Instance.recorder.isCustomPath) { path = PupilSettings.Instance.recorder.filePath + "/" + date; } path = path.Replace("Assets/", ""); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } UnityEngine.Debug.Log(path); PupilTools.StartPupilServiceRecording(path); Thread.Sleep(200); //Waiting for Pupil Service to create the incremented folder path += "/" + GetLastIncrement(path); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } Filename = "\"" + path + "/" + name + GetSuffix(codec) + "\""; var opt = "-y -f rawvideo -vcodec rawvideo -pixel_format rgb24"; opt += " -video_size " + width + "x" + height; opt += " -framerate " + framerate; opt += " -loglevel warning -i - " + GetOptions(codec); opt += " " + Filename; var info = new ProcessStartInfo(FFmpegConfig.BinaryPath, opt); info.UseShellExecute = false; info.CreateNoWindow = true; info.RedirectStandardInput = true; info.RedirectStandardOutput = true; info.RedirectStandardError = true; FilePath = path; _subprocess = Process.Start(info); _stdin = new BinaryWriter(_subprocess.StandardInput.BaseStream); }
void Start() { if (PupilGazeTracker._Instance == null) { PupilGazeTracker._Instance = this; } leftEye = new EyeData(); rightEye = new EyeData(); _dataLock = new object(); _serviceThread = new Thread(NetMQClient); _serviceThread.Start(); }
// Script initialization void Start() { output_ray = this.GetComponentInParent <OutputRay> (); // Get EyeTracker unity object _eyeTracker = PupilGazeTracker.Instance; if (HasEyeTracker) { Debug.Log("Failed to find pupil eye tracker, has it been added to scene?"); } }
void Start() { pupilTracker = PupilGazeTracker.Instance; PupilTools.OnConnected += OnConnected; PupilTools.OnCalibrationStarted += OnCalibtaionStarted; PupilTools.OnCalibrationEnded += OnCalibtaionEnded; //PupilTools.Connect (); }
private static PupilGazeTracker CheckScript() { PupilGazeTracker client = FindObjectOfType <PupilGazeTracker>(); if (client == null) { GameObject rootGameObject = new GameObject("Humanoid Pupil Gaze Tracker"); client = rootGameObject.AddComponent <PupilGazeTracker>(); } return(client); }
void Start() { mesh = new Mesh(); pupilTracker = PupilGazeTracker.Instance; // print (pupilTracker.CalibrationData.camera_intrinsics.camera_matrix); mRenderer = GetComponent <MeshRenderer> (); mRenderer.material = Resources.Load("Material/Pupil", typeof(Material)) as Material; Invoke("InitializePointClouds", 1f); _Instance = this; }
/// <summary> /// Gets called if PupilGazeTracker receives a new gazepoint. /// Initiates addition of a new TimePoint to the trajectories of all MovingObjects /// and to the gazeTrajectory /// </summary> /// <param name="manager"></param> void UpdateTrajectories(PupilGazeTracker manager) { // receive new gaze point. z.Value already is the corrected timestamp Vector3 newgaze = PupilGazeTracker.Instance.GetEyeGaze(Gaze); // add new gaze point to the trajectory gazeTrajectory.addNewGaze(newgaze.z, newgaze, w); // add positions at the moment of _correctedTs to all MovingObjects' trajectories foreach (MovingObject mo in sceneObjects) { mo.addNewPosition(newgaze.z, w); } }
void Awake() { VRCamera = GetComponent <Camera>(); Instance = this; Cursor.visible = false; _lineRenderer = GetComponent <LineRenderer>(); _pupilTracker = FindObjectOfType <PupilGazeTracker>(); _foveInterface = GetComponent <FoveInterface>(); _viveControllerTransforms = new List <Transform>(); _viveControllerTransforms.Add(transform.root.Find("Controller (right)")); //_viveControllerTransforms.Add(transform.root.Find("Controller (left)")); if (_drawRay) { _lineRenderer.positionCount = 2; } }
void Start() { // print ("Start of pupil gaze tracker"); Settings = PupilTools.Settings; string str = PupilConversions.ReadStringFromFile("camera_intrinsics"); PupilConversions.ReadCalibrationData(str, ref PupilData.CalibrationData); Settings.framePublishing.StreamCameraImages = false; if (Settings.framePublishing.StreamCameraImages) { Settings.framePublishing.InitializeFramePublishing(); } if (PupilGazeTracker._Instance == null) { PupilGazeTracker._Instance = this; } PupilData.calculateMovingAverage = true; //make sure that if the toggles are on it functions as the toggle requires it if (isOperatorMonitor && OnOperatorMonitor == null) { OperatorMonitor.Instantiate(); } //OnOperatorMonitor += DrawOperatorMonitor; if (Settings.debugView.active) { debugInstance.StartCalibrationDebugView(); } PupilGazeTracker.Instance.ProjectName = Application.productName; Settings.connection.isConnected = false; Settings.dataProcess.state = PupilSettings.EStatus.Idle; if (Settings.connection.isAutorun) { RunConnect(); } }
public static void Initialize() { window = (OperatorWindow)EditorWindow.GetWindow(typeof(OperatorWindow)); window.Show(); _texture = new Texture2D(1, 6); _texture.SetPixel(0, 0, new Color(1, 1, 1, .6f)); _texture.SetPixel(0, 1, new Color(1, 1, 1, .5f)); _texture.SetPixel(0, 2, new Color(1, 1, 1, .4f)); _texture.SetPixel(0, 3, new Color(1, 1, 1, .3f)); _texture.SetPixel(0, 4, new Color(1, 1, 1, .2f)); _texture.SetPixel(0, 5, new Color(1, 1, 1, .1f)); _texture.Apply(); // GameObject _camGO = new GameObject (); // _camGO.name = "Operator Camera"; // OperatorMonitor _opscript = _camGO.AddComponent<OperatorMonitor> (); // Camera _cam = _camGO.GetComponent<Camera> (); pupilTracker = PupilGazeTracker.Instance; Operator.properties.Properties = pupilTracker.OperatorMonitorProperties; // Operator.properties.Properties [0].OperatorCamera = _cam; // _cam.stereoTargetEye = StereoTargetEyeMask.None; // // _cam.backgroundColor = Color.gray; // _cam.transform.parent = Camera.main.transform; // _cam.fieldOfView = Camera.main.fieldOfView; // _cam.clearFlags = CameraClearFlags.Depth; // _opscript.MainCameraTargetDisplay = Camera.main.targetDisplay; // Camera.main.targetDisplay = 1; Operator.properties.Properties [0].confidenceList.Capacity = Operator.properties.Properties [0].graphLength + 1; Operator.properties.Properties [1].confidenceList.Capacity = Operator.properties.Properties [1].graphLength + 1; _offsetMatrix = new Matrix4x4(); pupilTracker.SubscribeTo("pupil."); pupilTracker.CreateEye0ImageMaterial(); pupilTracker.CreateEye1ImageMaterial(); pupilTracker.InitializeFramePublishing(); pupilTracker.StartFramePublishing(); }
public static void Instantiate() { _texture = new Texture2D(1, 6); _texture.SetPixel(0, 0, new Color(1, 1, 1, .6f)); _texture.SetPixel(0, 1, new Color(1, 1, 1, .5f)); _texture.SetPixel(0, 2, new Color(1, 1, 1, .4f)); _texture.SetPixel(0, 3, new Color(1, 1, 1, .3f)); _texture.SetPixel(0, 4, new Color(1, 1, 1, .2f)); _texture.SetPixel(0, 5, new Color(1, 1, 1, .1f)); _texture.Apply(); GameObject _camGO = new GameObject(); _camGO.name = "Operator Camera"; OperatorMonitor _opscript = _camGO.AddComponent <OperatorMonitor> (); Camera _cam = _camGO.GetComponent <Camera> (); pupilTracker = PupilGazeTracker.Instance; Operator.properties.Properties = pupilTracker.OperatorMonitorProperties; Operator.properties.Properties [0].OperatorCamera = _cam; _cam.stereoTargetEye = StereoTargetEyeMask.None; // _cam.backgroundColor = Color.gray; _cam.transform.parent = PupilTools.Settings.currentCamera.transform; _cam.transform.localPosition = Vector3.zero; _cam.transform.localEulerAngles = Vector3.zero; _cam.fieldOfView = PupilTools.Settings.currentCamera.fieldOfView; _cam.clearFlags = CameraClearFlags.Depth; _opscript.MainCameraTargetDisplay = PupilTools.Settings.currentCamera.targetDisplay; // PupilTools.Settings.currentCamera.targetDisplay = 1; Operator.properties.Properties [0].confidenceList.Capacity = Operator.properties.Properties [0].graphLength + 1; Operator.properties.Properties [1].confidenceList.Capacity = Operator.properties.Properties [1].graphLength + 1; _offsetMatrix = new Matrix4x4(); PupilTools.SubscribeTo("pupil."); PupilTools.StartFramePublishing(); }
void Start() { //XX: Change to object names in your scene Camera = GameObject.Find("EyeCube"); //Reference Object eye = GameObject.Find("Camera (eye)"); //Camera Object of VR player cam = eye.GetComponent <Camera>(); //Camera of VR player tracker = transform.GetComponentInParent <PupilGazeTracker>(); //Conenction to PupilGazeTracker //XX: Uncomment if you want automatic VP Number counting (no manual input -> less risk of overwriting data)--------- //if (VPNum.Length == 0)//If VPNum is not specified, analyze last subject recorded //{ // System.IO.StreamReader VPN = new System.IO.StreamReader(@"D:\v.kakerbeck\Tracking\currentVP.txt"); // VPNum = VPN.ReadLine(); // VPN.Close(); //} //newNum = System.Convert.ToInt16(VPNum) + 1; //VPNum = newNum.ToString(); //if (newNum < 10) { VPNum = "0" + newNum.ToString(); } //----------------------------------------------------------------------------------------------------------------- }
void Start() { lineRenderer1 = gameObject.AddComponent <LineRenderer>(); lineRenderer1.material = new Material(Shader.Find("Particles/Additive")); lineRenderer1.widthMultiplier = 0.02f; lineRenderer1.positionCount = 2; lineRenderer1.startColor = Color.yellow; lineRenderer1.endColor = Color.red; if (PupilGazeTracker._Instance == null) { PupilGazeTracker._Instance = this; } leftEye = new EyeData(GazeSmoothingSamplesCount); rightEye = new EyeData(GazeSmoothingSamplesCount); _dataLock = new object(); _serviceThread = new Thread(NetMQClient); _serviceThread.Start(); }
void Start() { #if UNITY_ANDROID Input.gyro.enabled = true; #endif _dbController = DBController.Instance; _pupilGazeTracker = FindObjectOfType <PupilGazeTracker>(); //If data is stored from TestLoader scene, use that if (_storedTestBlock != null) { LoadTestData(_storedTestBlock); } else { //If you need to run this scene repeatedly to test, create TestBlockData and load with LoadTestData(TestBlockData) and play project from MainScene LoadTestData(new TestBlock(TestBlock.VRHMD.NoHMD, "TestBlockData", "TestParticipant", "TestCondition", 11, new List <int>() { 80 }, new List <float>() { 50, 50 }, 100, 2, TestBlock.ControlMethod.Mouse, TestBlock.ConfirmationMethod.Click, 200, 80000, 5, 12, false, true, true, true, true, false, new Color32(67, 67, 67, 255), Color.yellow, Color.black, new Color32(200, 200, 200, 255), new Color32(128, 128, 128, 255), Color.red)); } float maxLength = TestBlockData.TargetAmplitudes.Select((el, i) => el + TestBlockData.TargetDiameters[i] / 2).Max(); VerticalShift = -((_targetCanvas.GetComponent <RectTransform>().rect.height / 2) - maxLength); //Debug.Log(Screen.height + " " + _targetCanvas.GetComponent<RectTransform>().rect.height + " " + maxLength + " " + VerticalShift + " " + _targetCanvas.scaleFactor + " " + Screen.height * _targetCanvas.scaleFactor); #if UNITY_EDITOR StartCoroutine(InputListener()); #endif _vrEyeTrackerController.StartTrackingMovement(); Cursor.lockState = CursorLockMode.Locked; GazeCursor.Instance.SetEnabled(_showCursor); SetPause(); }
void Start() { if (Debugger != null) { Debugger.AddDebugElement(this); } if (PupilGazeTracker._Instance == null) { PupilGazeTracker._Instance = this; } leftEye = new EyeData(SamplesCount); rightEye = new EyeData(SamplesCount); _dataLock = new object(); CalibrationModes = new Dictionary <CalibModes, CalibModeDetails> { { CalibModes._2D, new CalibModeDetails() { calibrationPoints = CalibPoints2D } }, { CalibModes._3D, new CalibModeDetails() { calibrationPoints = CalibPoints3D } } }; if (AutomaticallyStartService) { RunServiceAtPath(); } _serviceThread = new Thread(NetMQClient); _serviceThread.Start(); }
public FFmpegPipe(string name, int width, int height, int framerate, Codec codec) { PupilGazeTracker pupilTracker = PupilGazeTracker.Instance; //string path = PupilSettings.Instance.recorder.GetRecordingPath (); string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\Aalborg\\Projet\\GridCalibrationVR"; Thread.Sleep(200); //Waiting for Pupil Service to create the incremented folder path += "/" + GetLastIncrement(path); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } Filename = "\"" + path + "/" + name + GetSuffix(codec) + "\""; var opt = "-y -f rawvideo -vcodec rawvideo -pixel_format rgb24"; opt += " -video_size " + width + "x" + height; opt += " -framerate " + framerate; opt += " -loglevel warning -i - " + GetOptions(codec); opt += " " + Filename; var info = new ProcessStartInfo(FFmpegConfig.BinaryPath, opt); info.UseShellExecute = false; info.CreateNoWindow = true; info.RedirectStandardInput = true; info.RedirectStandardOutput = true; info.RedirectStandardError = true; FilePath = path; _subprocess = Process.Start(info); _stdin = new BinaryWriter(_subprocess.StandardInput.BaseStream); }