Face Detection

Create a face detection program, so when a face is detected, Phiro moves forward, using Pocket Code.

Objective

By the end of this lesson, learners will

  • Understand and use the computational concept of face detection blocks and Control to create a program
  • Create a program to control hardware with camera
  • Connect the physical and mobile digital worlds
  • Practice experimenting & iterating
Subjects

Robotics, Coding, Face Detection.

Age

9 & above

Duration

30 min

Robot & Accessories Needed

Phiro Pro robot

Download Material

Click here to Download

  • step1
  • step2
  • step3
  • step4
  • step5
  • step6
STEP 1

Ask

  • How does your smartphone or tablet's Camera work?
  • How Smartphone recognizes one's face automatically?
  • How would you use these to control something other than your phone?
STEP 2

Imagine

  • Imagine how you would control Phiro using Face detection option?
  • What would you need in Phiro and Pocket Code?
  • What are the face detection blocks available in pocket code?
STEP 3

Plan

Plan your Face Detection

Explore the different Face Detection Block in Pocket Code and plan how to use those in Face detection Program.

  • "is_face_detected" block is to check whether face is detected by mobile camera.
  • "face_size" block gives value between 0 to 100 depends on size of the detected face in camera.
  • "face_x_position" block gives x coordinate value in screen of detected face.
  • "face_y_position" block gives y coordinate value in screen of detected face.
STEP 4

Create

Create a new Pocket Code program to detect a face using your mobile device's camera and Phiro moves accordingly. Create a 'New program' and select 'Landscape' orientation.

Add or create two animation costumes to Background.

Create condition if face is detected, move Phiro forward, otherwise, stop.

Did the face detection code work? What did you do differently?

STEP 5

Remix

  • Remix your "face detection" program for Phiro to detect face on back camera and moves if detected.
  • Remix above program for Phiro detect and move according to "Face Size" speed.
STEP 6

Share

Share your Face Detection Phiro creation using #MyPhiro and we will share it with the world and PHIRO community!