PatchModels pmodel; //feature detectors public FaceTracker (string filepath) { points = new List<Point[]> (); string jsonText = null; #if UNITY_WSA var data = File.ReadAllBytes(filepath); jsonText = Encoding.UTF8.GetString(data, 0, data.Length); #else jsonText = File.ReadAllText(filepath); #endif // TextAsset textAsset = Resources.Load (filename) as TextAsset; // string jsonText = textAsset.text; IDictionary json = (IDictionary)Json.Deserialize (jsonText); IDictionary ft = (IDictionary)json ["ft object"]; detector = new FaceDetector (); detector.read (ft ["detector"]); smodel = new ShapeModel (); smodel.read (ft ["smodel"]); pmodel = new PatchModels (); pmodel.read (ft ["pmodel"]); }
PatchModels pmodel; //feature detectors public FaceTracker(string filepath) { points = new List <Point[]> (); string jsonText = null; using (System.IO.StreamReader reader = new System.IO.StreamReader(filepath)) { jsonText = reader.ReadToEnd(); reader.Close(); } // TextAsset textAsset = Resources.Load (filename) as TextAsset; // string jsonText = textAsset.text; IDictionary json = (IDictionary)Json.Deserialize(jsonText); IDictionary ft = (IDictionary)json ["ft object"]; detector = new FaceDetector(); detector.read(ft ["detector"]); smodel = new ShapeModel(); smodel.read(ft ["smodel"]); pmodel = new PatchModels(); pmodel.read(ft ["pmodel"]); }
ShapeModel smodel; //shape model #endregion Fields #region Constructors public FaceTracker(string filepath) { points = new List<Point[]> (); string jsonText = null; using (System.IO.StreamReader reader = new System.IO.StreamReader(filepath)) { jsonText = reader.ReadToEnd (); reader.Close (); } // TextAsset textAsset = Resources.Load (filename) as TextAsset; // string jsonText = textAsset.text; IDictionary json = (IDictionary)Json.Deserialize (jsonText); IDictionary ft = (IDictionary)json ["ft object"]; detector = new FaceDetector (); detector.read (ft ["detector"]); smodel = new ShapeModel (); smodel.read (ft ["smodel"]); pmodel = new PatchModels (); pmodel.read (ft ["pmodel"]); }
PatchModels pmodel; //feature detectors public FaceTracker(string filepath) { points = new List <Point[]> (); string jsonText = null; #if UNITY_WSA var data = File.ReadAllBytes(filepath); jsonText = Encoding.UTF8.GetString(data, 0, data.Length); #else jsonText = File.ReadAllText(filepath); #endif // TextAsset textAsset = Resources.Load (filename) as TextAsset; // string jsonText = textAsset.text; IDictionary json = (IDictionary)Json.Deserialize(jsonText); IDictionary ft = (IDictionary)json ["ft object"]; detector = new FaceDetector(); detector.read(ft ["detector"]); smodel = new ShapeModel(); smodel.read(ft ["smodel"]); pmodel = new PatchModels(); pmodel.read(ft ["pmodel"]); }