Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can use HaarCascade class in EmguCV (DotNet port of OpenCV) <a href="http://www.emgu.com/wiki/index.php/Face_detection" rel="nofollow">http://www.emgu.com/wiki/index.php/Face_detection</a></p> <blockquote> <p>Notes in order to run this example:</p> <ul> <li>Create a Windows Form Application </li> <li>Add a PictureBox and a Timer (and Enable it) - Run it on a x86 system </li> <li>Be sure you have the OpenCV relevant dlls (included with the Emgu CV download) in the folder where you code executes. </li> <li>Adjust the path to find the Haarcascade xml (last line of the code)</li> </ul> </blockquote> <pre><code>using System; using System.Windows.Forms; using System.Drawing; using Emgu.CV; using Emgu.Util; using Emgu.CV.Structure; using Emgu.CV.CvEnum; namespace opencvtut { public partial class Form1 : Form { private Capture cap; private HaarCascade haar; public Form1() { InitializeComponent(); } private void timer1_Tick(object sender, EventArgs e) { using (Image&lt;Bgr, byte&gt; nextFrame = cap.QueryFrame()) { if (nextFrame != null) { // there's only one channel (greyscale), hence the zero index //var faces = nextFrame.DetectHaarCascade(haar)[0]; Image&lt;Gray, byte&gt; grayframe = nextFrame.Convert&lt;Gray, byte&gt;(); var faces = grayframe.DetectHaarCascade( haar, 1.4, 4, HAAR_DETECTION_TYPE.DO_CANNY_PRUNING, new Size(nextFrame.Width/8, nextFrame.Height/8) )[0]; foreach (var face in faces) { nextFrame.Draw(face.rect, new Bgr(0,double.MaxValue,0), 3); } pictureBox1.Image = nextFrame.ToBitmap(); } } } private void Form1_Load(object sender, EventArgs e) { // passing 0 gets zeroth webcam cap = new Capture(0); // adjust path to find your xml haar = new HaarCascade( "..\\..\\..\\..\\lib\\haarcascade_frontalface_alt2.xml"); } } } </code></pre> <p>Here is the sample I wrote <a href="http://www.overroot.com/blog/wp-content/uploads/2011/03/FaceRecognition.zip" rel="nofollow">http://www.overroot.com/blog/wp-content/uploads/2011/03/FaceRecognition.zip</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload