 Hello everyone, welcome back to our channel. I hope you all are safe and sound. Many of you must have used face filters like the age filter on Snapchat or the blossom filter on Instagram. But did you ever wonder how these filters recognize your faces? The technique behind these filters is face recognition. Another fascinating concept of artificial intelligence. In this video, we are going to show you how to make a project that lets you choose filters among the ones displayed on the screen and apply it to your face using face detection extension of Pictoblox. Pre-requisites are a laptop or a computer with a camera, latest version of Pictoblox downloaded and a good internet connection. If you haven't downloaded Pictoblox yet, download it from the link given in the description box below. Let's begin by adding the face detection extension. Open Pictoblox. Click on board and select evive. Next, click on the add extension button. You need to keep two things in mind while working with the AI and ML extension. First, that your computer is connected to the internet and second, you need to log into your Pictoblox account to use it. Choose the face detection extension. Wait for a little while till the models get loaded. Let's begin by adding sprites to our project. Delete toby sprite by clicking on the delete button. Click on add sprite button and add the face filter sprite you want to apply on your face one by one. Let's make an additional sprite with a small message that prompts the user to click on different filters to try them. Thus, click on choose a sprite button and select paint. Use the rectangle tool to draw background and text to display the message. Now that the sprites are added, let's begin by setting the stage. Select the first face filter sprite. As we want to execute the program every time the green flag is clicked, place event flag clicked HUD block into the scripting area. To turn the camera on whenever we start the script, select the turn on video on stage with 0% transparency block from the face detection palette and select on from the first drop down. Now, get a forever block from the controls palette. Drag and drop an analyze image from stage block inside the forever block to continuous the analyze the image from the stage and apply the filter accordingly. Now to make the filter of the size of the face, drag and drop the set size to block from the looks palette. Place the get width of the face one block from the face detection palette inside the set size to block. Next, we need to detect the location where the face filter should be applied. Thus, add a go to XY block from the motion palette. Add the exposition of face in the X parameter, duplicate it and place it in the Y parameter. Select Y from the first drop down. Now let's make the filter library so that we can choose among the filters that we provide. Change the costumes from costumes tab for face filter 2 to heart google, face filter 3 to ground 1, face filter 4 to ground 2, face filter 5 to mustache, face filter 6 to bunny ears, face filter 7 to beard, face filter 8 to deer and face filter 9 to the face mask. You can even choose the filters of your choice. Now let's resize the filter and make them clickable. Select the face filter 2, drag and drop when flag clicked head block from the events palette. Next, set the size of the filter to 50%. Now to trigger a change in the filter, we will broadcast a message when a sprite is clicked. Thus drag and drop when the sprite is clicked block. Place broadcast message block below it and set the new message as heart goggles. Similarly do it for all the other face filters too. Now let's select the main face filter sprite and make a script to change the costume when it receives the broadcasted message. Place a when I receive broadcast block from the controls palette and select the heart goggles message from the drop down. Drag and drop the switch costume to block and select heart goggles from the drop down. Right click on the script and duplicated the number of times we have the face filters. Change it for each and every filter by selecting their broadcast message and costume from the drop down. With us, the code is complete. Click on the flag button and arrange your filters. To make the filters tilt in the direction in the angle in which our head tilts, we need to find out the angle of our head with the help of the position of the eyes. To know more, click on the link given in the description box below. You can make other filters than we have used and let us know by sharing it with us in our picture blocks community on Facebook. Also if you like this video, give it a thumbs up and don't forget to subscribe to STEMpedia and follow us on Facebook, Instagram and Twitter. Bye bye, stay safe.