Face Detection with Emgu CV in C# and WPF
- Posted: Sep 26, 2012 at 6:00 AM
- 16,950 Views
- 4 Comments
Loading User Information from Channel 9
Something went wrong getting user information from Channel 9
Loading User Information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
Today's project by Junian Triajianto is simple on the outside but shows off something that's can be very complex, face detection look easy...
Hi there, this is a new tutorial category in my blog. It's Computer Vision. In this blog, I'd like to show you something cool. It's how to perform Face Detection using your camera / Webcam. You'll see how your application can detect faces from a captured image. Curious about it? Let's take a look how to do that.
This what you need to follow this tutorial:
- Microsoft Visual Studio 2010. Or if you don't have one, you can use 2008 version
- Emgu CV (OpenCV in .NET). You can download the latest version in this link: http://www.emgu.com/wiki/index.php/Main_Page and follow the installation instruction
- Basic Knowledge of C# Programming
- Familiar in WPF Development
After you've got what you need, it's time to rock!
- First thing you should do is installing Emgu CV. Your installation path should be like C:\Emgu\emgucv-windows-x86 220.127.116.110. And you can see inside C:\Emgu\emgucv-windows-x86 18.104.22.1680\bin some DLLs and sample programs. You can see a simple face detection app Example.FaceDetection.exe and you'll see something like the first picture in this post.
8. Here is the result of our work:
Note : If you can't run your project, just build it and make sure all opencv_xxxx.dll files and haarcascade_frontalface_alt_tree.xml in the same directory with your executable file. You can find those files inside C:\Emgu\emgucv-windows-x86 22.214.171.1240\bin .
Take note of his note... Getting the OpenCV and EmguCV dependices were the hardest part of this project.
Also there there's been a file name change to the noted XML file, haarcascade_frontalface_alt_tree.xml. If you get the latest drop of emgucv-windows-x86 the file name's been changed to "haarcascade_frontalface_default.xml". So you'll need to tweak the code to take that into account.
Here's the before;
And the after;
Once the dependences are in place and the file name fixed, this ran like a charm and really did make facial detection look easy...
If you've been wondering how to do face detection, this project is one you'll want to check out...