//	public bool visualizeSphereProjection = false;

    void OnEnable()
    {
        // Main
        if (GetComponentInChildren <Camera> () == null)
        {
            Debug.Log("Frame Publisher could not find a Camera gameobject");
            return;
        }
        eyePublishingInitialized = new bool[] { false, false };

        PupilTools.SubscribeTo("frame.");

        PupilTools.Send(new Dictionary <string, object> {
            { "subject", "start_plugin" }, { "name", "Frame_Publisher" }
        });

//		// Sphere Projection
//		if (visualizeSphereProjection)
//		{
//			if (PupilTools.CalibrationMode == Calibration.Mode._3D)
//			{
//				PupilTools.SubscribeTo ("pupil.");
//			}
//			else
//				Debug.Log ("Sphere projections are only available for 3D calibration");
//		}

        PupilTools.OnReceiveData += CustomReceiveData;
    }
    public void StartVisualizingGaze()
    {
        Instance.OnUpdate += VisualizeGaze;

        PupilSettings.Instance.currentCamera = Camera.main;

        if (!PupilMarker.TryToReset(_markerLeftEye))
        {
            _markerLeftEye = new PupilMarker("LeftEye_2D", Color.green);
        }
        if (!PupilMarker.TryToReset(_markerRightEye))
        {
            _markerRightEye = new PupilMarker("RightEye_2D", Color.blue);
        }
        if (!PupilMarker.TryToReset(_markerGazeCenter))
        {
            _markerGazeCenter = new PupilMarker("Gaze_2D", Color.red);
        }
        if (!PupilMarker.TryToReset(_gaze3D))
        {
            _gaze3D = new PupilMarker("Gaze_3D", Color.yellow);
        }

        PupilTools.DataProcessState = EStatus.ProcessingGaze;
        PupilTools.SubscribeTo("gaze");
    }
Beispiel #3
0
    public void StartVisualizingGaze()
    {
        Instance.OnUpdate += VisualizeGaze;

        PupilSettings.Instance.currentCamera = Camera.main;

        if (!PupilMarker.TryToReset(_markerLeftEye))
        {
            _markerLeftEye = new PupilMarker("LeftEye_2D", PupilSettings.leftEyeColor);
        }
        if (!PupilMarker.TryToReset(_markerRightEye))
        {
            _markerRightEye = new PupilMarker("RightEye_2D", PupilSettings.rightEyeColor);
        }

        if (!PupilMarker.TryToReset(_markerGazeCenter))
        {
            _markerGazeCenter = new PupilMarker("Gaze_2D", Color.red);
        }
        if (!PupilMarker.TryToReset(_gaze3D))
        {
            _gaze3D = new PupilMarker("Gaze_3D", Color.yellow);
        }

        PupilTools.IsGazing = true;
        PupilTools.SubscribeTo("gaze");
    }
 void OnEnable()
 {
     if (PupilTools.IsConnected)
     {
         PupilTools.IsGazing = true;
         PupilTools.SubscribeTo("gaze");
     }
 }
	void OnEnable()
	{
		if (PupilTools.IsConnected)
		{
			PupilTools.DataProcessState = Pupil.EStatus.ProcessingGaze;
			PupilTools.SubscribeTo ("gaze");
		}
	}
 void OnEnable()
 {
     if (PupilSettings.Instance.connection.isConnected)
     {
         PupilSettings.Instance.DataProcessState = PupilSettings.EStatus.ProcessingGaze;
         PupilTools.SubscribeTo("gaze");
     }
 }
Beispiel #7
0
 void OnEnable()
 {
     if (PupilTools.IsConnected)
     {
         PupilTools.IsGazing = true;
         PupilTools.SubscribeTo("gaze");
         eyeCamera.gameObject.AddComponent <FramePublishing>();
     }
 }
Beispiel #8
0
 // Use this for initialization
 void Start()
 {
     // PupilTools.OnConnected += StartPupilSubscription;
     // PupilTools.OnDisconnecting += StopPupilSubscription;
     PupilTools.SubscribeTo("pupil.");
     PupilTools.SubscribeTo("gaze");
     PupilTools.OnReceiveData += CustomReceiveData;
     countDown = refreshTime;
 }
Beispiel #9
0
 void OnEnable()
 {
     if (PupilTools.IsConnected)
     {
         PupilTools.IsGazing = true;
         PupilTools.SubscribeTo("gaze");
         eyeCamera.gameObject.AddComponent <FramePublishing>();
     }
     collisionCircleLayer = (1 << LayerMask.NameToLayer("Circle"));
 }
    void Start()
    {
        PupilData.calculateMovingAverage = true;

        sceneCamera     = gameObject.GetComponent <Camera> ();
        calibrationDemo = gameObject.GetComponent <CalibrationDemo> ();
        heading         = gameObject.GetComponent <LineRenderer> ();

        PupilTools.SubscribeTo("gaze");
    }
Beispiel #11
0
 // Use this for initialization
 void Start()
 {
     ConfidenceBarSlider.minValue = 0;
     ConfidenceBarSlider.maxValue = 1;
     // PupilTools.OnConnected += StartPupilSubscription;
     // PupilTools.OnDisconnecting += StopPupilSubscription;
     PupilTools.SubscribeTo("pupil.");
     PupilTools.SubscribeTo("gaze");
     PupilTools.OnReceiveData += CustomReceiveData;
     countDown = refreshTime;
 }
Beispiel #12
0
    // Use this for initialization
    void OnEnable()
    {
        if (PupilTools.IsConnected)
        {
            wasAlreadyGazing = PupilTools.IsGazing;
            if (!wasAlreadyGazing)
            {
                PupilTools.IsGazing = true;
                PupilTools.SubscribeTo("gaze");
            }
        }

        cam = Camera.current;

        transform.localPosition = Vector3.zero;

        collisionLayer = (1 << LayerMask.NameToLayer("HeatmapMesh"));

        InitializeMeshes();

        switch (mode)
        {
        case HeatmapMode.Highlight:
            if (MaskingCamera != null)
            {
                MaskingCamera.backgroundColor = Color.white;
            }
            particleSystemParameters.startColor    = Color.black;
            particleSystemParameters.startSize     = particleSize * 0.1f;
            particleSystemParameters.startLifetime = removeParticleAfterXSeconds;
            break;

        case HeatmapMode.ParticleDebug:
            particleSystemParameters.startColor    = particleColor;
            particleSystemParameters.startSize     = particleSize * 0.05f;
            particleSystemParameters.startLifetime = removeParticleAfterXSeconds;
            //currentVisualization.gameObject.layer = 0;
            break;

        case HeatmapMode.Image:
            particleSystemParameters.startColor    = particleColor;
            particleSystemParameters.startSize     = particleSize * 0.033f;
            particleSystemParameters.startLifetime = float.MaxValue;
            visualizationParticles = new ParticleSystem.Particle[currentVisualization.main.maxParticles];
            break;

        default:
            particleSystemParameters.startColor    = particleColor;
            particleSystemParameters.startSize     = particleSize * 0.033f;
            particleSystemParameters.startLifetime = removeParticleAfterXSeconds;
            break;
        }
    }
        private static void StartBlinkSubscription()
        {
            PupilTools.Send(new Dictionary <string, object> {
                { "subject", "start_plugin" },
                { "name", "Blink_Detection" },
                { "args", new Dictionary <string, object> {
                      { "history_length", 0.2F },
                      { "onset_confidence_threshold", 0.5F },
                      { "offset_confidence_threshold", 0.5F }
                  } }
            });

            PupilTools.SubscribeTo("blinks");
        }
    // Use this for initialization
    public void Startup()
    {
        // Main
        if (camObj == null)
        {
            Debug.Log("Frame Publisher could not find a Camera gameobject");
            return;
        }
        eyePublishingInitialized = new bool[] { false, false };

        PupilTools.SubscribeTo("frame.");

        PupilTools.Send(new Dictionary <string, object> {
            { "subject", "start_plugin" }, { "name", "Frame_Publisher" }
        });
        PupilTools.OnReceiveData += CustomReceiveData;
    }
Beispiel #15
0
    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();
    }
Beispiel #16
0
    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();

        PupilTools.SubscribeTo("pupil.");

        PupilTools.StartFramePublishing();
    }
Beispiel #17
0
    public void StartVisualizingGaze()
    {
        OnUpdate += VisualizeGaze;

        bool isCalibrationMode2D = Settings.calibration.currentCalibrationMode == Calibration.CalibMode._2D;

        _markerLeftEye.SetActive(isCalibrationMode2D);
        _markerLeftEye.SetMaterialColor(Color.blue);
        _markerRightEye.SetActive(isCalibrationMode2D);
        _markerRightEye.SetMaterialColor(Color.red);
        _markerGazeCenter.SetActive(isCalibrationMode2D);
        _markerGazeCenter.SetMaterialColor(Color.magenta);
        _gaze3D.SetActive(!isCalibrationMode2D);
        if (isCalibrationMode2D)
        {
            PupilTools.SubscribeTo("gaze");
        }
        else
        {
            PupilTools.SubscribeTo("pupil.");
        }
    }
Beispiel #18
0
    void StartPupilSubscription()
    {
        PupilTools.CalibrationMode = Calibration.Mode._2D;

        PupilTools.SubscribeTo("pupil.");
    }
 private void PupilTools_OnCalibrationEnded()
 {
     PupilTools.IsGazing = true;
     PupilTools.SubscribeTo("gaze");
 }