0

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

Andrey
  • 61
  • 2
  • 6

1 Answers1

1

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;
}
Community
  • 1
  • 1
Mark Miller
  • 706
  • 4
  • 14