Course 8 / Lecture 3:

Face detection

Figure 1 -


Task #1:

Install face detection connection

Step 1: Plug in to your PC and add the camera to Ozeki10

In Ozeki 10 platform, you can use USB camera as a face detect camera, plug in to your PC. In the Control Panel you have to create a new connection. Click on the 'Create new conncetion' button and select the Video option. After that, choose the 'Vision' connection, so just select the Face camera connection. Lastly, you can settings the camera, the resolution and the framerate.

Figure 2 - Create the connection

Step 2: Create a route from the connection to Snap

You need to make a route connection to SNAP to get all information about the Face detect camera. So, select the Routes menu and click on the 'Create new Route' button and specify the information is come from the face detector connection to SNAP as you can see it on Figure 3 below.

Figure 3 - Create a route

Task #2:

Detect faces

Firstly, add the 'when green flag clicked' entry point from the Control menu. The most important thing is set the camera to detect face, so subscribe the face detector with using the 'Subscribe' block from the Ozeki menu and select the face detector camera. Then to wait for messages from the camera, add the 'Get next message' block. After that, store that message with the 'Set 'message' to message value (string)'. This is demonstrate in the Figure 4 below.

Figure 4 - Wait to the message

Task #2:

Modify your program to start the robot

You have to start the robot, so put the 'Start motor [motors] at [speed]%' block from the Lego motors menu between Subscribe and Get next message blocks. Select the A+D motors and set the motor speed to '10'. Now, robot goes forward until get information about the face recognize camera.

Figure 5 - Start the robot

Task #3:

Stop the robot and raise the robot's arm if the face is detected

If the camera is detected face, the robot stop moving and raise the arm, so add the 'Stop motor' block from the Lego motors menu and select the A+D motors. Then the robot stop moving. You have to add the 'Rotate [motor] by [degree]' block from the Lego motors menu, where select the 'B' motor and set the robot's arm degree to 180 as you can see it on Figure 5 below.

Figure 6 - Stop the robot

Task #4:

Display smile, set the Led to flahing and play some notes

Finally, drag 'Display on LCD' block from the Lego menu to the program and choose the smiley character. You have to set the LED flashing with green colour, so add the 'Set LED' block from the Lego menu and choose the green flashing option. After that, Add 3 'Play notes' blocks from the Lego menu and set them as you can see it on the Figure 6 below.

Figure 7 - It is happy to see you

Program code

Figure 8 -

More information


Copyright © 2000- |Ozeki Ltd | |
Page: 6137 | | Login