Calypso Module 8: Recognizing FacesFace DetectionTilt Cozmo's head up and position him so he can see your face. Notice the green box that appears around your face in the camera viewer. The box will be labeled with your name if Cozmo recognizes you; otherwise it will say "Unknown face". Notice that when a face is detected it is added to the world map. This way Cozmo can keep track of where his humans are. We can write rules to respond to the presence of a face. Let's make Cozmo greet anyone he meets by saying "Hello, human!". We'll require that the face be visible in the current camera frame, so if a face goes away and comes back later, Cozmo will greet it again. But to prevent excessive greeting, we'll use the "once" tile.We can also have Cozmo say something when he does not see any faces in the camera frame. This rule uses the "not" modifier. To make a "not see" tile, select "not" from the petal menu, then select "see". Try running the program and moving your face into and out of the camera frame. Teaching Cozmo to Recognize Your FaceFace detection allows Cozmo to know when he's looking at a face. Face recognition tells Cozmo whose face he's looking at. You must teach Cozmo your face if you want him to recognize it. This is easy to do:
With the rule below, whenever Cozmo sees Chris's face he will drive forward: We can also write a rule that looks for anything that is not Chris. We'll make Cozmo play a bark sound if he sees something. And we'll omit the "once" tile so that like any good guard dog Cozmo keeps barking until the thing goes away. Facial ExpressionsCozmo can recognize several facial expressions: happy, angry, sad, surprised, or neutral. How does he do this? Experiment: Try making faces at the camera and see how the emotion label changes. Notice that the face icon in the world map changes color to indicate the currently perceived expression: magenta for happy, blue for sad, red for angry, orange for surprised, and green for neutral. If Cozmo cannot recognize what the face is expressing then the icon will be gray, for "unknown". Calypso provides tiles for each of the recognized facial expressions:We can use these tiles to write rules that respond to particular expressions. Here's a rule that tells Cozmo to act playful whenever he sees a human face that appears surprised. If you change your expression from surprised to something else, and then change it back to surprised, Cozmo will act playful again: How Does Cozmo Describe A Face?You can get an idea of how Cozmo describes a face by looking closely in the camera viewer, or by looking at the details of the expression tiles above. A face is composed of four elements: two eyes, a nose, and a mouth.
Review and DiscoveryDo theNext ModuleIn the next module you'll learn how to make Cozmo do two things when a WHEN condition is true.Back to Calypso Curriculum overview. Copyright © 2017 Visionary Machines LLC. |