void FrameGrabber(object sender, EventArgs e) { try { actualFrame = cv.CapturarFrame(); cv.ConvertirFrameAGrises(actualFrame); MCvAvgComp[][] _FacesDetected = cv.FacesDetection(); foreach (MCvAvgComp f in _FacesDetected[0]) { cv.CrearTrainedFace(f); Face = cv.LastTrainingImage(); /*if (trainingImages.ToArray().Length!=0) * { * MCvTermCriteria termCriterio=new MCvTermCriteria(trainingImages.ToArray().Length,0.001); * EigenObjectRecognizer recognizer=new EigenObjectRecognizer(trainingImages.ToArray(),aliasList.ToArray(), 3000, ref termCriterio); * aliasDetected=recognizer.Recognize(Face); * actualFrame.Draw(aliasDetected,ref font, new Point(f.rect.X-2,f.rect.Y-2),new Bgr(Color.Green)); * }*/ } //pbImagen.Image = actualFrame.ToBitmap(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void FrameGrabber(object sender, EventArgs e) { try { actualFrame = cv.CapturarFrame(); cv.ConvertirFrameAGrises(actualFrame); MCvAvgComp[][] _FacesDetected = cv.FacesDetection(); foreach (MCvAvgComp f in _FacesDetected[0]) { cv.DibujarRecognitionRectangle(f); } pbImagen.Image = actualFrame.ToBitmap(); } catch (Exception ex) { MessageBox.Show(ex.Message); throw; } }