public void onImageResults(Dictionary <int, Affdex.Face> faces, Affdex.Frame image) { // For now only single face is supported if ((faces.Count() >= 1)) { Affdex.Face face = faces[0]; if (face.Id == 0) { guid = Guid.NewGuid(); } UpdateClassifierPanel(face); DisplayFeaturePoints(image, face); DisplayMeasurements(face); FaceEntity entity = new FaceEntity(guid, face, DateTimeOffset.Now); #if DEBUG faceModel.FaceEntities.Add(entity); //foreach (Affdex.FeaturePoint point in face.FeaturePoints) //{ // faceModel.FeaturePointEntities.Add(new FeaturePointEntity(guid, face.Id, point)); //} faceModel.SaveChanges(); using (Stream stream = new MemoryStream()) { using (StreamReader reader = new StreamReader(stream)) { serialiser.WriteObject(stream, entity); stream.Position = 0; System.Diagnostics.Debug.WriteLine(reader.ReadToEnd()); } } #endif hubClient.Send(new EventData(entity, serialiser)); } }
public void onImageResults(Dictionary<int, Affdex.Face> faces, Affdex.Frame image) { // For now only single face is supported if ((faces.Count() >= 1)) { Affdex.Face face = faces[0]; if (face.Id == 0) guid = Guid.NewGuid(); UpdateClassifierPanel(face); DisplayFeaturePoints(image, face); DisplayMeasurements(face); FaceEntity entity = new FaceEntity(guid, face, DateTimeOffset.Now); #if DEBUG faceModel.FaceEntities.Add(entity); //foreach (Affdex.FeaturePoint point in face.FeaturePoints) //{ // faceModel.FeaturePointEntities.Add(new FeaturePointEntity(guid, face.Id, point)); //} faceModel.SaveChanges(); using(Stream stream = new MemoryStream()) { using (StreamReader reader = new StreamReader(stream)) { serialiser.WriteObject(stream, entity); stream.Position = 0; System.Diagnostics.Debug.WriteLine(reader.ReadToEnd()); } } #endif hubClient.Send(new EventData(entity, serialiser)); } }