[MUSIC] Okay, so in this last part I've added some code to kind of show what actually is being tracked and kind of give you an idea of one way you might be able to set up overlays over the actual image as it's playing on the screen. So okay, so what I have here are, is a property here that let's me track all these overlay views that I'm going to show on the screen while this is tracking the face. So what I'm going to get is a bunch of points for each feature of the face. So eyes, eyebrows, nose, mouth, and for each of those points, I'm going to create a little view, just a U eye view, blank view with the color as a background, just so I can see exactly where those features are detected on the screen. And I'm going to move those views around as the points move around on the screen. So I've created a dictionary here for overlayViews and it's going to have a separate array of views for each feature of the face so I can have different colors for the different features to make it easier to take a look and troubleshoot and see what's going on. Okay, so, all these methods here are still the same. We have the prepareForSegue and viewDidAppear. Now, I'll just skip past a couple things. I'll go back in a sec. So this is the faceTrackerDidUpdate method here, like I just showed you, but I've actually added some code. So what can happen is it's going to receive points and it can either receive null or it can actually receive some points so if the face tracker stops actually detecting a face on the screen it will, may send nil here. So the first thing we're going to do is just check to make sure that we are actually receiving some points and the logic goes that. If it doesn't receive any points, it's just going to hide all of our overlay views because the face has disappeared from the camera. Once it gets these points it's going to iterate through several properties of this points object. So there's a separate property for each facial feature and each property's actually an array of actual points. So, each feature might have several points associated with it, and when you see it on the screen, it kind of makes a little outline. And, if I want to actually dig in further and see more about what's going on with this FacePoints object, if I hold the Command key down, I can actually click on that, and I can see here the definition file for that. So, even though this is a pre-compiled binary, I can still see the exported class definition here so I can get an idea of what the API looks like just by pressing command and clicking on the symbol there. So as you see here under FacePoints, you can see it's got about seven different types of FacePoints here, and it's got an array of points for each of those. So this is the object that we are getting in that method. So we can also see a little bit more about the actual face tracker view controller, and some of the special methods that it also implements. You'll see that it's got that startTracking thing here, but it's also got a couple extra methods you might be interested in, for example, stopTracking and swapCamera, which should start, if you send a message to swapCamera, it should switch to using the alternate camera on the device. So for example, you could put like a little button that says swapCamera, and then you could call this method whenever that button is hit, for example. Okay, so I'm just going to go back and just take a look at this. So, for each of those properties, say for example, leftEye, it's going to iterate through all the points in that leftEye array. And then, what I'm actually doing here is, let's see, let's go back. Okay, so what I'm actually doing here is I am calling my special method here that I've created, updateViewForFeature. And I'm just tracking each of these views by a string that is related to the actual feature property here. And I'm giving it the point that it's received. And I'm also giving this method a color, so I can have different colors for the different features. So that just repeats for each of these properties so it's very repetitive. And that's basically it for this method. So, if I go back up and look at this updateViewForFeature, this is what's actually adding those views to the screen. So, what it does is it creates a rectangle. So, a very small four by four pixel, or point rectangle and uses that to setup the overlay views. The first thing it does is it makes sure that there is an array of views already created for this specific feature in my overlayViews dictionary, and then what I've done is just checked to make sure that either of you already exist and it's just getting updated, or I have to create a new view and add it as a subview. And once it's added then it gets added to that dictionary to track in the future. And then in the future it will be updated rather than being recreated. So that smooths things out, you're not adding or removing views all the time but this It's a little bit of a quick hack, because it actually assumes that the number of pixels doesn't change, that it's consistent. But it works well for our purposes here. I'm just investigating how this view controller works, and how good the face tracking is, and what its actually giving for us. If you take a look at the demo project that comes with the face tracker, STK, you'll see that it does a little bit of a different thing, it has little picture that it shows on the screen and instead of just showing the points or using the points directly, it does a little bit of math to determine the angle of the tracked face and to move the, and twist and transform the picture instead of just showing straight points. So, maybe that's a little bit more advanced than what we're doing here, but it gives you an idea of some of the more creative things that you can do with these points. So, you know, this is a good starting point, I think. It shows you how it works, and once you have this up and running, then you can start playing with different ideas and you can start experimenting with it and getting an idea of how these features are being tracked. Okay, so that's it for implementing the face tracker. All right thank you for following along.