Reputation: 71
i'd want to add mask on my recognised face during live video capturing with EMGU CV, C#, WPF, I've already done live video capturing and had a PNG mask, how to impose PNG image to my video? faces are recognised and imposed by small non-filled rectangles, so I can easily get coordinates of faces center
Upvotes: 0
Views: 2725
Reputation: 706
It appears the answer is as simple as overlaying the PNG image to the video. Here's some example code, originally from here:
public static Image<Bgra, Byte> Overlay(Image<Bgra, Byte> target, Point targetPoint, Image<Bgra, Byte> overlay)
{
Bitmap bmp = target.Bitmap;
Graphics gra = Graphics.FromImage(bmp);
gra.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver;
gra.DrawImage(overlay.Bitmap, targetPoint);
return target;
}
Upvotes: 1