Reader small image

You're reading from  Hands-On Neural Network Programming with C#

Product typeBook
Published inSep 2018
Reading LevelIntermediate
PublisherPackt
ISBN-139781789612011
Edition1st Edition
Languages
Right arrow
Author (1)
Matt Cole
Matt Cole
author image
Matt Cole

Matt R. Cole is a developer and author with 30 years' experience. Matt is the owner of Evolved AI Solutions, a provider of advanced Machine Learning/Bio-AI, Microservice and Swarm technologies. Matt is recognized as a leader in Microservice and Artificial Intelligence development and design. As an early pioneer of VOIP, Matt developed the VOIP system for NASA for the International Space Station and Space Shuttle. Matt also developed the first Bio Artificial Intelligence framework which completely integrates mirror and canonical neurons. In his spare time Matt authors books, and continues his education taking every available course in advanced mathematics, AI/ML/DL, Quantum Mechanics/Physics, String Theory and Computational Neuroscience.
Read more about Matt Cole

Right arrow

Face and Motion Detection

Now it is time for us to get into a really neat application. We'll start off by using the open source package http://www.aforgenet.com/ to build a face and motion detection application. To do this, you'll need to have a camera installed in your system to see live streaming video. From there, we will use that camera to detect faces as well as motion. In this chapter, we are going to show two separate examples: one for facial detection, the other for motion detection. We'll show you exactly what goes on, and just how fast you can add these capabilities into your application.

In this chapter, we will cover such topics as:

  • Facial detection
  • Motion detection
  • How to use the local video-integrated camera
  • Image filtering/algorithms

Let's start out with facial detection. In our example, I'm going to use my friendly little French bulldog...

Technical requirements

Facial detection

Now, let's take a quick look at our application. You should have the sample solution loaded into Microsoft Visual Studio:

And here's a look at our sample application running. Say Hi to Frenchie everyone!

As you can see, we have a very simple screen that is dedicated to our video capture device. In this case, the laptop camera is our video capture device. Frenchie is kindly posing in front of the camera for us, and as soon as we enable facial tracking, look what happens:

The facial features of Frenchie are now being tracked. What you see surrounding Frenchie are the tracking containers (white boxes), and our angle detector (red line) displayed. As we move Frenchie around, the tracking container and angle detector will track him. That's all well and good, but what happens if we enable facial tracking on a real human face? As you can see in the...

Motion detection

We will now make our focus a bit more wide-scale and detect any motion at all, not just faces. Again, we'll use Accord.Net for this and use the Motion detection sample. As with facial recognition, you will see just how simple it is to add this capability to your applications and instantly become a hero at work! Let's make sure you have the correct project loaded into Microsoft Visual Studio:

With motion detection, anything that moves on the screen we will highlighted in red, so using the following screenshot you can see that the fingers are moving but everything else remains motionless:

In the following screenshot, you can see more movement, denoted by the red blocks along this anonymous hand:

In the following screenshot, you can see that the entire hand is moving:

If we do not wish to process the entire screen area for motion, we can define motion...

Summary

In this chapter, we learned about image and motion detection (not recognition!). We used Accord.Net as an example of what open-source tools provide us with when we want to add power to our applications.

In the next chapter, we remain with the image theme, but work on training Convolutional Neural Networks with the open-source package ConvNetSharp.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Hands-On Neural Network Programming with C#
Published in: Sep 2018Publisher: PacktISBN-13: 9781789612011
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Matt Cole

Matt R. Cole is a developer and author with 30 years' experience. Matt is the owner of Evolved AI Solutions, a provider of advanced Machine Learning/Bio-AI, Microservice and Swarm technologies. Matt is recognized as a leader in Microservice and Artificial Intelligence development and design. As an early pioneer of VOIP, Matt developed the VOIP system for NASA for the International Space Station and Space Shuttle. Matt also developed the first Bio Artificial Intelligence framework which completely integrates mirror and canonical neurons. In his spare time Matt authors books, and continues his education taking every available course in advanced mathematics, AI/ML/DL, Quantum Mechanics/Physics, String Theory and Computational Neuroscience.
Read more about Matt Cole