• Secondary
  • Lesson 14 : Face Expression Detector

Lesson 14 : Face Expression Detector

Lesson Description

In this lesson, students will be implementing the concepts learned in the previous lesson to understand how facial recognition works. By implementing the concepts learned to make an activity on Face Expression Detection.

Face Recognition

Face recognition systems allow programs to identify a person by analyzing the face landmarks of her/his face in a digital image.

  1. When a face is analyzed, its geometrical properties, size, and position are obtained.
  2. A structure is generated that forms a pattern that is later stored in a database.
  3. Once stored, the user’s facial record is compared with the biometric features of each face that is scanned and allows adding new templates to make the recognition more effective.
  4. If the image matches a search, the system will alert us that a match has been found.

Face Recognition Application

  1. Face recognition is used to detect faces in real-time for surveillance and tracking persons or objects. Suvillance
  2. It is widely used in cameras to identify multiple appearances within one frame such as in mobile phone cameras and DSLRs.Camera-Face-Recognition
  3. Facebook also uses a face detection algorithm to detect faces in the images and recognize them.Facebook-Tagging
  4. Modern phones have a face unlock feature which recognizes the face and checks whether it is authorized for access or not. Face-detection-phone

 

In this project, we will make a script that detects the face using the camera and reports the expression the faces detected on the stage.

Let’s begin!

Setting Up the Stage

  1. Open PictoBlox and create a New File.
  2. Select the coding environment as Block Coding.
  3. Add a new Square Box sprite and delete the Tobi Sprite.
    New Sprite
  4. Drag and drop a when flag clicked block into the scripting area.
  5. Add Face Detection Extension.
    Face Detection Extension
  6. Snap a turn () video on stage with () transparency block from the Face Detection palette. Change the camera option to on and transparency to 0%.

The stage is set. Click the green flag to get the camera feed on the stage.

Recognize Image

  1. We will continue with the same script.
  2. Add a forever block from the Control palette.
  3. Snap a analyse image from () block. Select the feed as the camera.

Display Emotions and Tracking

  1. Add a say () block. Add a get expression of face () block in the input. Add the Face reporter block in the face number input.
  2. Then, add a set x to () block. Add a get () of face () block in the input. Change the parameter to the x position and add the Face reporter block in the face number input.
  3. Next, add a set y to () block. Add a get () of face () block in the input. Change the parameter to the y position and add the Face reporter block in the face number input.
  4. Snap a set size to () % block from the Looks palette.
  5. Next, add get () of the face () block from the face detection palette. Select the parameter as width and add the Face reporter block in the face number input.
  6. Save the file with the name Face Expression Detector.

Your script is now complete.

Click the green flag to start the script.

Assignment

Before you move on to the next lesson, a small assignment awaits you!

You must upload the PictoBlox program you created in this activity to the website. Submitting the assignment is a must in order to receive the certificate after completing the course.

Follow the steps below to upload your assignment:

  1. Click on Browse.
  2. Search and Select your saved Project file(.sb3) and Click Open.
  3. Click on Upload to submit the assignment.
evive Alert
The file type allowed is the SB3 file generated from the PictoBlox program. The maximum file size allowed is 5 MB.

Good luck!

Table of Contents