Software apps and online services

Story

Project Background

We
used Raspberry Pi 2, Azure, Oxford Project and Wechat to realize the following
process. Using Face Detection SDK based on Windows 10 IoT core to detect
whether there is a human face in our camera, then uploads the capture of human
face to the Azure website. Then we use the background platform provided by
Azure Website to get the SDK of face detection and identity of Project Oxford to
check whether the capture of the human face matches the information in our
existed human face database. Then the feedback will be sent to Raspberry Pi and
message will be pushed to wechat public platform. The Raspberry Pi will
transfer the result by the voice of speaker based on speech synthesis API. Developer
can get the information of how to use Windows 10 Face Detection SDK、Project Oxford through this demo.

The Whole Project Architecture

Setup steps

1: Device Setup

Connect the audio port of speaker
to the audio port of Raspberry Pi. USB is powered cable so you can connect it to
other powered device or directly connected to Raspberry Pi.

Connect the camera of USB to Raspberry
Pi.
Raspberry Pi needs to be connected to Internet.

;

;

1 / 4 • The Speaker

Then Run the FaceDetection UWP app on Windows IoT Core

Click the face detection button then the UWP app begin to detect face.

Code

CreateFaceDetectionEffectAsync

C#

CreateFaceDetectionEffectAsync

privateasyncTaskCreateFaceDetectionEffectAsync(){// Create the definition, which will contain some initialization settingsvardefinition=newFaceDetectionEffectDefinition();// To ensure preview smoothness, do not delay incoming samplesdefinition.SynchronousDetectionEnabled=false;// In this scenario, choose detection speed over accuracydefinition.DetectionMode=FaceDetectionMode.HighPerformance;// Add the effect to the preview stream_faceDetectionEffect=(FaceDetectionEffect)await_mediaCapture.AddVideoEffectAsync(definition,MediaStreamType.VideoPreview);// Register for face detection events_faceDetectionEffect.FaceDetected+=FaceDetectionEffect_FaceDetected;// Choose the shortest interval between detection events_faceDetectionEffect.DesiredDetectionInterval=TimeSpan.FromMilliseconds(33);// Start detecting faces_faceDetectionEffect.Enabled=true;}

FaceDetectionEffect_FaceDetected

C#

When Detected the Face, we will create a face bounding boxes and upload the picture to the azure

FaceDetectionButton_Tapped

C#

When the FaceDetection Button pressed, we will create FaceDetectionEffect

privateasyncvoidFaceDetectionButton_Tapped(objectsender,TappedRoutedEventArgse){if(_faceDetectionEffect==null||!_faceDetectionEffect.Enabled){// Clear any rectangles that may have been left over from a previous instance of the effectFacesCanvas.Children.Clear();awaitCreateFaceDetectionEffectAsync();}else{awaitCleanUpFaceDetectionEffectAsync();}UpdateCaptureControls();}

FaceDetectionWithIoT

This is the client of this solution, which is the Windows 10 UWP app runs on the Raspberry Pi

FaceDetectionServerSide

Face detection IoT demo is a demo combining Windows 10 IoT Core @RPi2 and Azure and Project Oxford, to implement a scenario that people's face can be captured in the real time video ingested from the camera on RPi2 and be identified through analysis in Azure and Project Oxford. The code is for demo's backend server.