Proposed Face screenshot

  • Thursday, April 19, 2012 4:48 PM
     
     

    Hey there!

    Does anyone have any idea how to capture the face and make its snapshot and save it to bitmap???

    I already read the article about making screenshots, but I still have no idea how to save a specific area as image data...

    I would appreciate that if someone could help me.

All Replies

  • Sunday, April 22, 2012 1:25 PM
     
     Proposed Has Code

    Hi,

    There is a wrapper for the Open CV call Emgu

    these library is contains 3 references (Emgu.CV, Emgu.CV.UI, Emgu.Util)

    you can work and get the face easily with these libraries

    Download here

    and run the following code sample

    using (HaarCascade face = new HaarCascade(faceFileName))
    {
      var frame = _kinectSensor.ColorStream.OpenNextFrame(100);
      var image = frame.ToOpenCVImage<Rgb, Byte>();
      using (Image<Gray, Byte> gray = image.Convert<Gray, Byte>()) //Convert it to Grayscale
      {
        gray._EqualizeHist();
        MCvAvgComp[] facesDetected = face.Detect(
                           gray,
                           1.1,
                           10,
    Emgu.CV.CvEnum.HAAR_DETECTION_TYPE.DO_CANNY_PRUNING,
                           new System.Drawing.Size(20, 20));
        foreach (MCvAvgComp f in facesDetected)
        {
          var rect = new System.Drawing.Rectangle(f.rect.X - f.rect.Width / 2
                                , f.rect.Y - f.rect.Height / 2
                                , f.rect.Width * 2
                                , f.rect.Height * 2);
                            image.Draw(f.rect, new Rgb(System.Drawing.Color.Blue), 2);
        }
        Dispatcher.BeginInvoke(new Action(() => { yourImage.Source = image.ToBitmapSource(); }));
      }
    }


    Thanks,
    MOHAMED A. SAKR | Software Development Lead Engineer | EgyptNetwork
    Please remember to click “Mark as Answer” on the post that helps you. This can be beneficial to other community members. Also try to Vote as Helpful


    • Proposed As Answer by MohamedSakr Sunday, April 22, 2012 1:25 PM
    • Edited by MohamedSakr Sunday, April 22, 2012 1:25 PM
    •  
  • Monday, April 23, 2012 12:17 PM
     
     
    Any Updates

    Thanks,
    MOHAMED A. SAKR | Software Development Lead Engineer | EgyptNetwork
    Please remember to click “Mark as Answer” on the post that helps you. This can be beneficial to other community members. Also try to Vote as Helpful