public List <Bitmap> GetFacesBitmap(bool draw) { var facesBitmap = new List <Bitmap>(); if (_faces == null) { _faces = DetectFace.DetectAll(_image); } var imageCpy = _image.Copy(); foreach (FaceFeatures f in _faces) { if (f.IsValid) { // Get face and display on a picture box if (draw) { f.DrawToImage(imageCpy, 2, true, false); } var image = f.GetFaceImage(imageCpy); var target = image.Bitmap; facesBitmap.Add(new Bitmap(target, new Size(target.Width / 4, target.Height / 4))); } } return(facesBitmap); }
public void Draw(bool includeEyesNoseMouth) { if (_faces == null) { _faces = DetectFace.DetectAll(_image); } foreach (FaceFeatures f in _faces) { // Draw even if it is not valid f.DrawToImage(_image, 1, includeEyesNoseMouth, false); } }
public void Save(String folderPath) { if (_faces == null) { _faces = DetectFace.DetectAll(_image); } int i = 1; foreach (FaceFeatures f in _faces) { if (f.IsValid) { f.Save(folderPath, i++, _image); } } }