Lesson 1,
Topic 1
In Progress
Activity 1: Basic Face Filter
Objective
To track the face and put the face filter on top of it.
Let’s Code
- Open PictoBlox and open Face Filter saved sb3 file and continue from there.
- Select the First face filter sprite.
- As we want to execute the program every time the green flag is clicked, thus place the when flag clicked hat block into the scripting area.
- To turn on the camera 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 Controls palate.
- Drag and drop an analyse image from stage block inside the forever block to continuously analyze the image from the camera and apply the filter accordingly.
- Next, we need to detect the location where the face filter should be applied, thus add a set x to () block from the Motion palette.
- Add the get () of face () block from the Face Detection palette in the parameter and choose x position from the first drop-down.
- Repeat for Y position.
- Now to make the filter of the size of the face, drag and drop set size to % block from the Looks palette.
- Place the get () of face () block from Face Detection palette, inside the set size to block and choose the width from the first drop-down and 1 from the second.
Save the file.
Click on the green flag and run the project.