If you are trying to save the images to a folder, then I would do something like this:
...
if (this.takeTrainingImage)
{
this.targetFaces.Add(new BitmapSourceTargetFace
{
Image = (Bitmap)face.GrayFace.Clone(),
Key = this.NameField.Text
});
//save image
JpegBitmapEncoder encoder = new JpegBitmapEncoder();
BitmapFrame outputFrame = BitmapFrame.Create(LoadBitmap(e.ProcessedBitmap));
encoder.Frames.Add(face.GrayFace);
encoder.QualityLevel = 96dpi;
using (FileStream file = File.OpenWrite("C://Users//Your Name//Documents//Face Trainer//Images//face " + targetFaces.Count + ".jpg"))
{
encoder.Save(file);
}
this.takeTrainingImage = false;
this.NameField.Text = this.NameField.Text.Replace(this.targetFaces.Count.ToString(), (this.targetFaces.Count + 1).ToString());
if (this.targetFaces.Count > 1)
this.engine.SetTargetFaces(this.targetFaces);
}
....
Then to load from the files...
string[] files = System.IO.Directory.GetFiles("C://Users//Your Name//Documents//Face Trainer//Images//");
Bitmap[] images = new Bitmap[files.Length];
for (int i = 0; i < files.Length; i++)
{
images[i] = (Bitmap) Image.FromFile(file, true);
}
If you are trying to add the images to an actually database, I would follow this tutorial.
I would recommend saving the images to a file since you are beginning, and using databases requires much more work. However, when you are more experienced databases are very effective at this sort of thing. Good luck!:)