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

  1. Open PictoBlox and open Face Filter saved sb3 file and continue from there.
  2. Select the First face filter sprite.
  3. 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.
  4. 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.
  5. Now get a forever block from Controls palate.
  6. 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.
  7. 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.
  8. Add the get () of face () block from the Face Detection palette in the parameter and choose x position from the first drop-down.
  9. Repeat for Y position.
  10. Now to make the filter of the size of the face, drag and drop set size to % block from the Looks palette.
  11. 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.