private void RecognizeUser(ref Image <Bgr, byte> original, Image <Gray, byte> grayframe, Rectangle rectangle) { grayframe.ROI = rectangle; var size = Properties.Settings.Default.RecognitionImageSize; try { var id = RecognitionEngine.RecognizeUser(grayframe.Copy().Resize(size, size, Inter.Cubic)); if (id > 0) { var user = RecognitionData.GetUser(id); if (user != null) { original.Draw(user.Username, new Point(rectangle.Left, rectangle.Top - 10), FontFace.HersheyPlain, 2, new Bgr(Color.DarkTurquoise)); } } } catch (CvException) { // ignored } }