This function is used to analyze the image received as input from the stage, for faces.
Alert: This block processes the image input and updates the values in the other functions hence it needs to be put inside loops while making projects.
Function Definition: analysestage()
This function is used to analyze the image received as input from the stage, for faces.
Alert: This block processes the image input and updates the values in the other functions hence it needs to be put inside loops while making projects.
The example demonstrates the application of face detection with a stage feed. Following are the key steps happening:
sprite = Sprite('Square Box')
import time
fd = FaceDetection()
# Disable Bounding Box on the stage
fd.disablebox()
# Set Theshold of the stage
fd.setthreshold(0.4)
fd.analysestage()
print(fd.count())
for i in range(fd.count()):
sprite.setx(fd.x(i + 1))
sprite.sety(fd.y(i + 1))
sprite.setsize(fd.width(i + 1))
sprite.say("Face " + str(i + 1) + ": " + fd.expression(i + 1))
time.sleep(1)
The example demonstrates how to use face landmarks in the projects. Following are the key steps happening:
sprite = Sprite('Ball')
fd = FaceDetection()
import time
pen = Pen()
pen.clear()
sprite.setsize(10)
fd.enablebox()
fd.analysestage()
for i in range(68):
sprite.setx(fd.landmarksx(1, i+1))
sprite.sety(fd.landmarksy(1, i+1))
pen.stamp()
time.sleep(0.2)
A face-tracking robot is a type of robot that uses sensors and algorithms to detect and track human faces in real time. The robot’s sensors, such as cameras or infrared sensors, capture images or videos of the surrounding environment and use computer vision techniques to analyze the data and identify human faces. One of the most fascinating activities is face tracking, in which the Quadruped can detect a face and move its head in the same direction as yours. How intriguing it sounds, so let’s get started with the coding for a face-tracking Quadruped robot.
we will learn how to use face detection to control the movement of a Quadruped robot and how to incorporate external inputs into a program to create more interactive and responsive robotics applications.
sprite = Sprite('Tobi')
quarky=Quarky()
import time
import math
quad=Quadruped(4,1,8,5,3,2,7,6)
fd = FaceDetection()
fd.video("on", 0)
fd.enablebox()
fd.setthreshold(0.5)
time.sleep(1)
Angle=0
while True:
fd.analysestage()
for i in range(fd.count()):
sprite.setx(fd.x(i + 1))
sprite.sety(fd.y(i + 1))
sprite.setsize(fd.width(i + 1))
Angle=fd.width(i + 1)
angle=int(float(Angle))
if angle>90:
quad.move("lateral right",1000,1)
elif angle<90:
quad.move("lateral left",1000,1)
else:
quad.home()
Our next step is to check whether it is working right or not. Whenever your face will come in front of the camera, it should detect it and as you move to the right or left, the head of your Quadruped robot should also move accordingly.
Copyright 2024 – Agilo Research Pvt. Ltd. All rights reserved – Terms & Condition | Privacy Policy