私はC#のWebカメラを操作するためにAForgeライブラリを使用しましたが、APIがどれほどクリーンであるかが気に入りました。ビデオにタイムスタンプを追加する方法、スナップショットを撮る方法などのサンプルは次のとおりです。http:
//www.aforgenet.com/framework/samples/video.html
私が正しく理解していれば、スナップショットを撮るときに元のフレームが必要なので、フレームにペイントする前にそのコピーを作成します。
Image lastUneditedFrame;
private void VideoSourcePlayer_NewFrame(object sender, ref Bitmap image)
{
if (lastUneditedFrame != null)
{
lastUneditedFrame.Dispose();
}
lastUneditedFrame = image.Clone(new Rectangle(0, 0, image.Width, image.Height), image.PixelFormat);
var graphics = Graphics.FromImage(image);
// do the drawing of photo frame
graphics.Dispose();
}
// on snapshot button click, simply call lastUneditedFrame.Save();