public override void Init() { base.Init(); GazeFollowComponent gaze = GameObject.FindObjectOfType <GazeFollowComponent> (); AddDataSource(new EyeGazeXDataSource(gaze)); AddDataSource(new EyeGazeYDataSource(gaze)); for (int i = 0; i < PresenceLayers.Length; ++i) { AddDataSource(new PresenceLayerActiveDataSource("Layer" + i.ToString(), PresenceLayers [i])); AddDataSource(new PresenceLayerWeightDataSource("LayerWeight" + i.ToString(), PresenceLayers [i])); AddDataSource(new PresenceLayerAudioLevelDataSource("AudioLevel" + i.ToString(), PresenceLayers [i])); } AddSamplingCondition(new Data.TimeOutSamplingCondition(1000 / SamplingRate)); }
// Use this for initialization void Start() { Gaze = GameObject.FindObjectOfType <GazeFollowComponent> (); BasePresenceLayerComponent[] layers = GameObject.FindObjectsOfType <BasePresenceLayerComponent> (); List <BasePresenceLayerComponent> resLayers = new List <BasePresenceLayerComponent> (); LayersParameters.FaceConfig.cascadePath = (Application.dataPath + LayersParameters.FaceConfig.cascadePath).Replace("/", "\\"); for (int i = 0; i < layers.Length; ++i) { if (layers[i].enabled) { if (layers [i] != BaseLayer || AutoBaseLayer) { resLayers.Add(layers[i]); } layers [i].SetManager(this); } } Layers = resLayers.ToArray(); _job = new ImageDetectorJob(this); _job.Start(); if (Pointer == null) { Pointer = GameObject.FindObjectOfType <CrosshairPointer> (); } //ObjectSerializer.DeSerializeObject<PresenceLayerParameters> (Application.dataPath + "\\Data\\LayerParams.xml",ref LayersParameters ); if (Debugger != null) { Debugger.AddDebugElement(new DebugDetails(this)); } }
public EyeGazeXDataSource(GazeFollowComponent g) { GazeSource = g; }
public GazeBasedLayerSelection(GazeFollowComponent g) { Gaze = g; }
void Start() { Gaze = GameObject.FindObjectOfType <GazeFollowComponent> (); _processor = new OffscreenProcessor(); _processor.ShaderName = "GazeBased/Blend"; Image <Gray, byte> cache = null; EmguImageUtil.UnityTextureToOpenCVImageGray(TargetTexture, ref cache); //new Mat(pictureStr, LoadImageType.Color); //Read the files as an 8-bit Bgr image long detectionTime; List <Rectangle> faces = new List <Rectangle>(); List <Rectangle> eyes = new List <Rectangle>(); //The cuda cascade classifier doesn't seem to be able to load "haarcascade_frontalface_default.xml" file in this release //disabling CUDA module for now bool tryUseCuda = true; bool tryUseOpenCL = false; DetectObjectCL.DetectFace( cache.Mat, false, faces, eyes, tryUseCuda, tryUseOpenCL, out detectionTime); foreach (Rectangle face in faces) { CvInvoke.Rectangle(cache.Mat, face, new Bgr(0, 0, 1).MCvScalar, 2); } foreach (Rectangle eye in eyes) { CvInvoke.Rectangle(cache.Mat, eye, new Bgr(1, 0, 0).MCvScalar, 2); } Debug.Log("detected faces:" + faces.Count); Debug.Log("face detection time:" + detectionTime.ToString() + "ms"); //display the image /* ImageViewer.Show(image, String.Format( * "Completed face and eye detection using {0} in {1} milliseconds", * (tryUseCuda && CudaInvoke.HasCuda) ? "GPU" * : (tryUseOpenCL && CvInvoke.HaveOpenCLCompatibleGpuDevice) ? "OpenCL" * : "CPU", * detectionTime)); */ _map = new ImageFeatureMap(128, 128); foreach (Rectangle face in faces) { Rectangle r = new Rectangle(); r.X = face.X - 50; r.Y = face.Y - 5; r.Width = face.Width + 50; r.Height = face.Height + 520; _map.FillRectangle((float)r.X / (float)cache.Mat.Width, (float)r.Y / (float)cache.Mat.Height, (float)r.Width / (float)cache.Mat.Width, (float)r.Height / (float)cache.Mat.Height, 1); } _map.Blur(); _map.Blur(); _map.Blur(); _map.Blur(); Texture2D tex = new Texture2D(1, 1); tex.filterMode = FilterMode.Point; _map.ConvertToTexture(tex, true); _processor.ProcessingMaterial.SetTexture("_TargetMask", tex); _processor.ProcessingMaterial.SetTexture("_MainTex", TargetTexture); GetComponent <UITexture> ().mainTexture = tex; //_processor.ProcessTexture (TargetTexture); }
// Use this for initialization void Start() { _camera = GetComponent <TxKitEyes> (); _Alpha = MinAlpha; Gaze = GameObject.FindObjectOfType <GazeFollowComponent> (); }
public GazeHeadController() { _Gaze = GameObject.FindObjectOfType <GazeFollowComponent> (); }