예제 #1
0
        public static async Task <AddedFaceData> InsertFace(Image <Bgr, byte> original, Image <Gray, byte> grayframe, string username)
        {
            var size = Properties.Settings.Default.RecognitionImageSize;

            original  = original.Resize(size, size, Inter.Cubic);
            grayframe = grayframe.Resize(size, size, Inter.Cubic);

            var userId = await DatabaseHandler.InsertAsync("INSERT INTO users (username) VALUES (@username)", new SQLiteParameter("@username", username));

            var faceId = await DatabaseHandler.InsertAsync("INSERT INTO faces (original, grayframe, userID, width, height) VALUES (@original, @grayframe, @userId, @width, @height)",
                                                           new SQLiteParameter("@original", DbType.Binary)
            {
                Value = original.Bytes
            },
                                                           new SQLiteParameter("@grayframe", DbType.Binary)
            {
                Value = grayframe.Bytes
            },
                                                           new SQLiteParameter("@userId", userId),
                                                           new SQLiteParameter("@width", original.Width),
                                                           new SQLiteParameter("@height", original.Height)
                                                           );

            AllFaces.Add(new Face(original, grayframe, (int)faceId, username, (int)userId));

            AllUsers.Add(new User((int)userId, username));

            return(new AddedFaceData(userId, faceId));
        }
예제 #2
0
    public void SetFace(FeelType feel)
    {
        _lastFace    = _currentFace;
        _currentFace = feel;
        Face face = AllFaces.Where(f => f.FaceType == feel).FirstOrDefault();

        Eyes.sprite  = face.Eyes;
        Mouth.sprite = face.Mouth;
    }
예제 #3
0
 private static void AllFacesOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs notifyCollectionChangedEventArgs)
 {
     RecognitionEngine.TrainRecognizer(AllFaces.ToList());
 }